diff options
| author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-12 21:03:29 +0000 |
|---|---|---|
| committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-12 21:03:29 +0000 |
| commit | 82cfc7f78d8763c79bfeb24481ff1311b81ce8a4 (patch) | |
| tree | 239fe82df92b5becd01501ce3dc7a59b3ac1f02c | |
| parent | e4e9f87304768a7f95baa3006ffc1f71a7133515 (diff) | |
| download | ppe42-gcc-82cfc7f78d8763c79bfeb24481ff1311b81ce8a4.tar.gz ppe42-gcc-82cfc7f78d8763c79bfeb24481ff1311b81ce8a4.zip | |
* c-common.c (combine_strings): Emit a pedantic warning when a
string length is greater than the minimum ANSI C is required
to support.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34999 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/c-common.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eed3f141902..bc3f53bd4b0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2000-07-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * c-common.c (combine_strings): Emit a pedantic warning when a + string length is greater than the minimum ANSI C is required + to support. + Wed Jul 12 13:24:30 2000 Jeffrey A Law (law@cygnus.com) * pa/xm-pa64.h (NO_SYS_SIGLIST): Kill. diff --git a/gcc/c-common.c b/gcc/c-common.c index b6cf58e466b..f72ec47ee85 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -294,6 +294,7 @@ combine_strings (strings) int wide_flag = 0; int wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT; int nchars; + const int nchars_max = flag_isoc99 ? 4095 : 509; if (TREE_CHAIN (strings)) { @@ -373,6 +374,10 @@ combine_strings (strings) /* Compute the number of elements, for the array type. */ nchars = wide_flag ? length / wchar_bytes : length; + if (pedantic && nchars > nchars_max) + pedwarn ("string length `%d' is greater than the minimum length `%d' ANSI C is required to support", + nchars, nchars_max); + /* Create the array type for the string constant. -Wwrite-strings says make the string constant an array of const char so that copying it to a non-const pointer will get a warning. |

