This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.4 PATCH: Fix bootstrap failure with SGI's MIPSpro C 7.3
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 1 Aug 2003 23:45:54 +0200 (MEST)
- Subject: 3.4 PATCH: Fix bootstrap failure with SGI's MIPSpro C 7.3
A bootstrap of current mainline (configured with CC=cc --disable-nls) on
IRIX 6.5.10m with SGI's MIPSpro C 7.3 cc failed like this:
cc-1140 cc: ERROR File = /.vol/gcc/src/gcc-dist/gcc/opts.c, Line = 135
A value of type "char *" cannot be used to initialize an entity of type "char".
static const char undocumented_msg[] = N_("This switch lacks documentation");
^
1 error detected in the compilation of "/.vol/gcc/src/gcc-dist/gcc/opts.c".
While the old (completely different) O32 cc (i.e. cc -32) is fine with this
construct, the problem boils down to this minimal testcase:
#define N_(msgid) (msgid)
const char undocumented_msg[] = N_("This switch lacks documentation");
The 7.3 cc errors as above, while the latest cc 7.4 compiles this without
problems. Checking other vendor compilers (in their strictest ANSI/ISO C
mode) only gave a message with Compaq C:
$ cc -V
Compaq C V6.3-029 on Compaq Tru64 UNIX V5.1 (Rev. 732)
Compiler Driver V6.3-030 (sys) cc Driver
$ cc -std1 -c n_.c
cc: Warning: n_.c, line 3: In the initializer for undocumented_msg, accepting a string literal in parentheses as the initializer for a character array is a language extension. (parenliteral)
const char undocumented_msg[] = N_("This switch lacks documentation");
--------------------------------^
I'm not sure this is true: gcc doesn't give a warning about this ever
(i.e. even with -std=c99 -pedantic -Wall -W). gcc may be in error here.
Removing the parentheses from the N_ definition in gcc/intl.h fixed this
and allowed the bootstrap to continue (still failed after a successful
comparison for unrelated reasons).
Ok for mainline?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Fri Aug 1 00:08:55 2003 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* intl.h (N_): Remove parentheses.
Index: gcc/intl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/intl.h,v
retrieving revision 1.8
diff -u -p -r1.8 intl.h
--- gcc/intl.h 4 Jul 2003 18:18:53 -0000 1.8
+++ gcc/intl.h 1 Aug 2003 21:36:48 -0000
@@ -48,7 +48,7 @@ extern size_t gcc_gettext_width (const c
#endif
#ifndef N_
-# define N_(msgid) (msgid)
+# define N_(msgid) msgid
#endif
#endif /* intl.h */