gc.flags[FLG_NUMLITERAL] = TRUE;
gc.flags[FLG_DUPLICATEQUALS] = TRUE;
gc.flags[FLG_SKIPISOHEADERS] = TRUE;
- gc.flags[FLG_SKIPPOSIXHEADERS] = TRUE;
+ gc.flags[FLG_SKIPPOSIXHEADERS] = FALSE;
gc.flags[FLG_SYSTEMDIREXPAND] = TRUE;
gc.flags[FLG_UNRECOGCOMMENTS] = TRUE;
gc.flags[FLG_UNRECOGFLAGCOMMENTS] = TRUE;
FLG_CHECKSTRICTGLOBALS, FLG_IMPCHECKEDSPECGLOBALS,
FLG_MACROMATCHNAME, FLG_WARNLINTCOMMENTS,
FLG_INCLUDENEST, FLG_ISORESERVED, FLG_CPPNAMES,
- FLG_NOPARAMS, FLG_IFEMPTY, FLG_WHILEEMPTY, FLG_REALCOMPARE,
+ FLG_NOPARAMS, FLG_IFEMPTY, FLG_WHILEEMPTY, FLG_REALCOMPARE, FLG_REALRELATECOMPARE,
FLG_BOOLOPS, FLG_SHIFTNEGATIVE,
FLG_SHIFTIMPLEMENTATION,
FLG_BUFFEROVERFLOWHIGH, FLG_BUFFEROVERFLOW,
FLG_FOREMPTY, FLG_WHILEEMPTY,
FLG_IFEMPTY, FLG_IFBLOCK,
FLG_ELSEIFCOMPLETE,
- FLG_REALCOMPARE, FLG_BOOLOPS,
+ FLG_REALCOMPARE, FLG_BOOLOPS, FLG_REALRELATECOMPARE,
FLG_SYSTEMDIRERRORS, FLG_UNUSEDSPECIAL,
FLG_SHIFTNEGATIVE,
if (cc == '\n')
{
/* Backslash newline is replaced by nothing at all. */
+ pfile->lineno++; /* 2003-11-03: AMiller suggested adding this, but
+ its not clear why it is needed. */
cppReader_adjustWritten (pfile, -1);
pfile->lineno++;
}
}
else
{
- voptgenerror
- (FLG_REALCOMPARE,
- message ("Dangerous comparison involving %s types: %s",
- ctype_unparse (rtype),
- exprNode_unparse (ret)),
- ret->loc);
+ if (opid == EQ_OP || opid == NE_OP)
+ {
+ voptgenerror
+ (FLG_REALCOMPARE,
+ message ("Dangerous equality comparison involving %s types: %s",
+ ctype_unparse (rtype),
+ exprNode_unparse (ret)),
+ ret->loc);
+ }
+ else
+ {
+ voptgenerror
+ (FLG_REALRELATECOMPARE,
+ message ("Possibly dangerous relational comparison involving %s types: %s",
+ ctype_unparse (rtype),
+ exprNode_unparse (ret)),
+ ret->loc);
+ }
}
}
/*@fallthrough@*/
FK_OPS, FK_NONE, modeFlag,
"realcompare",
FLG_REALCOMPARE,
- "dangerous comparison between reals (dangerous because of inexact "
+ "dangerous equality comparison between reals (dangerous because of inexact "
"floating point representations)",
"Two real (float, double, or long double) values are compared "
- "directly using a C primitive. "
+ "directly using == or != primitive. "
+ "This may produce unexpected results since floating point "
+ "representations are inexact. Instead, compare the difference to "
+ "FLT_EPSILON or DBL_EPSILON.",
+ 0, 0,
+ },
+ {
+ FK_OPS, FK_NONE, modeFlag,
+ "realrelatecompare",
+ FLG_REALRELATECOMPARE,
+ "possibly dangerous relational comparison between reals (dangerous because of inexact "
+ "floating point representations)",
+ "Two real (float, double, or long double) values are compared "
+ "directly using < or >. "
"This may produce unexpected results since floating point "
"representations are inexact. Instead, compare the difference to "
"FLT_EPSILON or DBL_EPSILON.",
info.c:6:57: Unrecognized pre-processor directive:
#info "LcLint ignores all code that follows this line!"
info.c: (in function unhuppy_bug)
-info.c:9:3: Observer storage assigned to unqualified reference: i = "Asdf"
- info.c:9:7: Storage becomes observer
+info.c:10:3: Observer storage assigned to unqualified reference: i = "Asdf"
+ info.c:10:7: Storage becomes observer
info.c:1:13: File static function huppy_bug declared but not used
info.c:4:1: Definition of huppy_bug