diff options
author | Geoffrey Keating <geoffk@redhat.com> | 2000-12-02 22:32:15 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2000-12-02 22:32:15 +0000 |
commit | 690c96c8bf01285496eceb96ff13b4ddc84a75f4 (patch) | |
tree | 6f96bbab2ead17d505acf9ef55a6a8000cbce14b | |
parent | b43db0b3c0184f5c6901865f5d30ba2a704e412b (diff) | |
download | gcc-690c96c8bf01285496eceb96ff13b4ddc84a75f4.zip gcc-690c96c8bf01285496eceb96ff13b4ddc84a75f4.tar.gz gcc-690c96c8bf01285496eceb96ff13b4ddc84a75f4.tar.bz2 |
c-common.c (combine_strings): When the ISO C standard specifies the maximum length of a string...
* c-common.c (combine_strings): When the ISO C standard specifies
the maximum length of a string, it doesn't include the trailing
zero byte.
* gcc.dg/cpp/if-6.c: New testcase.
From-SVN: r37961
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-common.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/if-6.c | 3 |
4 files changed, 14 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a08a83..11b01ab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,8 @@ -2000-12-01 Geoffrey Keating <geoffk@redhat.com> +2000-12-02 Geoffrey Keating <geoffk@redhat.com> + + * c-common.c (combine_strings): When the ISO C standard specifies + the maximum length of a string, it doesn't include the trailing + zero byte. * cpplib.c (do_ifdef): Add check_eol() call. (do_ifndef): Likewise. diff --git a/gcc/c-common.c b/gcc/c-common.c index 465bdbe..6e33945 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -468,9 +468,9 @@ combine_strings (strings) /* Compute the number of elements, for the array type. */ nchars = wide_flag ? length / wchar_bytes : length; - if (pedantic && nchars > nchars_max && c_language == clk_c) + if (pedantic && nchars - 1 > 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); + nchars - 1, nchars_max, flag_isoc99 ? 99 : 89); /* Create the array type for the string constant. -Wwrite-strings says make the string constant an array of const char diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 367f5d8..00397daa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,7 +1,9 @@ -2000-12-01 Geoffrey Keating <geoffk@redhat.com> +2000-12-02 Geoffrey Keating <geoffk@redhat.com> + + * gcc.dg/cpp/if-6.c: New testcase. * gcc.dg/20001201-1.c: New testcase. - + 2000-12-02 Neil Booth <neilb@earthling.net> * g++.old-deja/g++.other/externC4.C, diff --git a/gcc/testsuite/gcc.dg/cpp/if-6.c b/gcc/testsuite/gcc.dg/cpp/if-6.c new file mode 100644 index 0000000..1f23d2c --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/if-6.c @@ -0,0 +1,3 @@ +/* { dg-do preprocess } */ +#ifdef foo bar /* { dg-error "extra tokens" "tokens after #ifdef" } */ +#endif |