Patch to avoid "string length > minimum length" warnings for C++
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Fri Nov 3 10:55:00 GMT 2000
The consensus seems to be that these warnings aren't valid/useful in
C++. (I decided they also weren't useful in ObjC.) Okay to install?
--Kaveh
2000-11-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-common.c (combine_strings): Only warn about long strings for C.
diff -rup orig/egcs-CVS20001102/gcc/c-common.c egcs-CVS20001102/gcc/c-common.c
--- orig/egcs-CVS20001102/gcc/c-common.c Thu Nov 2 21:44:31 2000
+++ egcs-CVS20001102/gcc/c-common.c Thu Nov 2 22:06:00 2000
@@ -426,7 +426,7 @@ combine_strings (strings)
/* Compute the number of elements, for the array type. */
nchars = wide_flag ? length / wchar_bytes : length;
- if (pedantic && nchars > nchars_max)
+ if (pedantic && nchars > nchars_max && c_language == clk_c)
pedwarn ("string length `%d' is greater than the minimum length `%d' ISO C%d is required to support",
nchars, nchars_max, flag_isoc99 ? 99 : 89);
More information about the Gcc-patches
mailing list