This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Changes to gcc.c (display_help)
- To: meissner at cygnus dot com, pthomas at suse dot de
- Subject: Re: Changes to gcc.c (display_help)
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Tue, 27 Jun 2000 14:28:10 -0400 (EDT)
- Cc: gcc-patches at gcc dot gnu dot org
> From: Michael Meissner <meissner@cygnus.com>
>
> On Tue, Jun 27, 2000 at 09:48:09AM +0200, Philipp Thomas wrote:
> > While I only had intended to mark the help text in display_help
> > for translation, I ended up modifiying it. First this changes
> > printf to fputs where possible and secondly tries to output as
> > much text as possible in one call instead of one printf per
> > line. Main reason is, that translating the help text is much
> > easier this way.
> > OK to commit?
>
> No. It would not compile under a strict ISO C compiler, which has strict
> limits on string length (IIRC, 508 characters).
Okay, then would this be appropriate?
2000-06-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-common.c (combine_strings): Emit a pedantic warning when a
string length is greater than 508.
diff -rup orig/egcs-CVS20000626/gcc/c-common.c egcs-CVS20000626/gcc/c-common.c
--- orig/egcs-CVS20000626/gcc/c-common.c Mon Jun 26 10:00:17 2000
+++ egcs-CVS20000626/gcc/c-common.c Tue Jun 27 13:40:35 2000
@@ -370,6 +370,9 @@ combine_strings (strings)
/* Compute the number of elements, for the array type. */
nchars = wide_flag ? length / wchar_bytes : length;
+ if (pedantic && nchars > 508)
+ pedwarn ("string length %d is greater than ANSI C maximum 508", nchars);
+
/* 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.