------- Additional Comments From trt at acm dot org  2005-06-06 15:48 -------
I recommend a version with fewer false positives.
I've been using a warning like this for years, with zero false positives.
The current gcc-4-ified version is:

-   /* check for comparing string constant with anything besides simple zero */
-   if (TREE_CODE_CLASS (code) == tcc_comparison && extra_warnings
-       && (code1 == STRING_CST) != (code2 == STRING_CST)
-       && !integer_zerop (arg1.value) && !integer_zerop (arg2.value))
-     warning (0, "comparison of pointer with string literal");

An older suggestion is http://gcc.gnu.org/ml/gcc-patches/1999-10n/msg00548.html

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7776

Reply via email to