This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to get x86-dgux working
- To: gcc-patches at gcc dot gnu dot org
- Subject: Patch to get x86-dgux working
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Mon, 8 Oct 2001 18:14:04 -0400 (EDT)
When cross compiling to i386-dg-dgux, I get this error:
> dgux.c: At top level:
> dgux.c:55: warning: initialization discards qualifiers from pointer target type
> dgux.c:55: warning: implicit declaration of function `N_'
> dgux.c:55: initializer element is not constant
> dgux.c:55: (near initialization for `m_options[0].description')
> dgux.c:55: warning: missing initializer
> dgux.c:55: warning: (near initialization for `m_options[0].description')
> dgux.c:55: initializer element is not constant
> dgux.c:55: (near initialization for `m_options[0]')
> [...]
> dgux.c:55: warning: initialization discards qualifiers from pointer target type
> dgux.c:55: initializer element is not constant
> dgux.c:55: (near initialization for `m_options[63]')
> make: *** [dgux.o] Error 1
The problem is that dgux.c needs to include intl.h to define N_.
While I was at it, I cleaned up a bunch of warnings.
Tested by building a cross cc1 to target i386-dg-dgux.
Okay to install?
--Kaveh
2001-10-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* i386/dgux.c: Include intl.h. Rename lang_independent_option to
lang_independent_options and const-ify it.
(output_option, output_options): Prototype and const-ify. Fix
signed/unsigned warnings.
(m_options): Const-ify.
* i386/dgux.h (PREFERRED_DEBUGGING_TYPE): Undef before defining.
* i386/i386-protos.h (output_file_start): Prototype.
* i386/sysv4.h (ASM_OUTPUT_FLOAT, ASM_OUTPUT_DOUBLE,
ASM_OUTPUT_LONG_DOUBLE): Fix format specifier warnings.
* toplev.c (lang_independent_options): Name the struct as well
as the typedef.
diff -rup orig/egcs-CVS20011007/gcc/config/i386/dgux.c egcs-CVS20011007/gcc/config/i386/dgux.c
--- orig/egcs-CVS20011007/gcc/config/i386/dgux.c Mon Apr 16 14:30:40 2001
+++ egcs-CVS20011007/gcc/config/i386/dgux.c Mon Oct 8 16:53:02 2001
@@ -21,26 +21,34 @@ Boston, MA 02111-1307, USA. */
#include <time.h>
#include "i386/i386.c"
+#include "intl.h"
-struct lang_independent_option
+struct lang_independent_options
{
- char *string;
+ const char *string;
int *variable;
int on_value;
- char *description;
+ const char *description;
};
+static int output_option PARAMS ((FILE *, const char *, const char *,
+ const char *, const char *, int, int));
+static void output_options PARAMS ((FILE *, struct lang_independent_options *,
+ int, struct lang_independent_options *,
+ int, int, int, const char *, const char *,
+ const char *));
+
static int
output_option (file, sep, type, name, indent, pos, max)
FILE *file;
- char *sep;
- char *type;
- char *name;
- char *indent;
+ const char *sep;
+ const char *type;
+ const char *name;
+ const char *indent;
int pos;
int max;
{
- if (strlen (sep) + strlen (type) + strlen (name) + pos > max)
+ if ((int)(strlen (sep) + strlen (type) + strlen (name)) + pos > max)
{
fprintf (file, indent);
return fprintf (file, "%s%s", type, name);
@@ -48,24 +56,24 @@ output_option (file, sep, type, name, in
return pos + fprintf (file, "%s%s%s", sep, type, name);
}
-static struct {
- char *name;
- int value;
- const char * description;
+static const struct {
+ const char *const name;
+ const int value;
+ const char *const description;
} m_options[] = TARGET_SWITCHES;
static void
output_options (file, f_options, f_len, W_options, W_len,
pos, max, sep, indent, term)
FILE *file;
- struct lang_independent_option *f_options;
- struct lang_independent_option *W_options;
+ struct lang_independent_options *f_options;
+ struct lang_independent_options *W_options;
int f_len, W_len;
int pos;
int max;
- int sep;
- char *indent;
- char *term;
+ const char *sep;
+ const char *indent;
+ const char *term;
{
register int j;
@@ -90,7 +98,7 @@ output_options (file, f_options, f_len,
pos = output_option (file, sep, "-W", W_options[j].string,
indent, pos, max);
- for (j = 0; j < ARRAY_SIZE (m_options); j++)
+ for (j = 0; j < (int)(ARRAY_SIZE (m_options)); j++)
if (m_options[j].name[0] != '\0'
&& m_options[j].value > 0
&& ((m_options[j].value & target_flags)
@@ -112,8 +120,8 @@ output_options (file, f_options, f_len,
void
output_file_start (file, f_options, f_len, W_options, W_len)
FILE *file;
- struct lang_independent_option *f_options;
- struct lang_independent_option *W_options;
+ struct lang_independent_options *f_options;
+ struct lang_independent_options *W_options;
int f_len, W_len;
{
register int pos;
diff -rup orig/egcs-CVS20011007/gcc/config/i386/dgux.h egcs-CVS20011007/gcc/config/i386/dgux.h
--- orig/egcs-CVS20011007/gcc/config/i386/dgux.h Tue Sep 11 13:36:08 2001
+++ egcs-CVS20011007/gcc/config/i386/dgux.h Mon Oct 8 15:34:48 2001
@@ -80,6 +80,7 @@ Boston, MA 02111-1307, USA. */
#undef DBX_DEBUGGING_INFO
#define DBX_DEBUGGING_INFO
+#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
/* Override svr[34].h. */
diff -rup orig/egcs-CVS20011007/gcc/config/i386/i386-protos.h egcs-CVS20011007/gcc/config/i386/i386-protos.h
--- orig/egcs-CVS20011007/gcc/config/i386/i386-protos.h Fri Sep 28 16:30:23 2001
+++ egcs-CVS20011007/gcc/config/i386/i386-protos.h Mon Oct 8 16:57:10 2001
@@ -192,3 +192,11 @@ extern unsigned int i386_pe_section_type
int));
extern void i386_pe_asm_named_section PARAMS ((const char *, unsigned int));
#endif
+
+#ifdef ANSI_PROTOTYPES
+struct lang_independent_options;
+#endif
+extern void output_file_start PARAMS ((FILE *,
+ struct lang_independent_options *,
+ int, struct lang_independent_options *,
+ int));
diff -rup orig/egcs-CVS20011007/gcc/config/i386/sysv4.h egcs-CVS20011007/gcc/config/i386/sysv4.h
--- orig/egcs-CVS20011007/gcc/config/i386/sysv4.h Tue May 22 16:30:44 2001
+++ egcs-CVS20011007/gcc/config/i386/sysv4.h Mon Oct 8 15:34:48 2001
@@ -51,7 +51,7 @@ Boston, MA 02111-1307, USA. */
do { long value; \
REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value); \
if (sizeof (int) == sizeof (long)) \
- fprintf((FILE), "%s0x%x\n", ASM_LONG, value); \
+ fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value); \
else \
fprintf((FILE), "%s0x%lx\n", ASM_LONG, value); \
} while (0)
@@ -67,8 +67,8 @@ do { long value[2]; \
REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value); \
if (sizeof (int) == sizeof (long)) \
{ \
- fprintf((FILE), "%s0x%x\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s0x%x\n", ASM_LONG, value[1]); \
+ fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[0]); \
+ fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[1]); \
} \
else \
{ \
@@ -84,9 +84,9 @@ do { long value[3]; \
REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value); \
if (sizeof (int) == sizeof (long)) \
{ \
- fprintf((FILE), "%s0x%x\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s0x%x\n", ASM_LONG, value[1]); \
- fprintf((FILE), "%s0x%x\n", ASM_LONG, value[2]); \
+ fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[0]); \
+ fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[1]); \
+ fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[2]); \
} \
else \
{ \
@@ -134,7 +134,7 @@ do { long value[3]; \
} \
for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
continue; \
- if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
+ if (p < limit && (p - _ascii_bytes) <= (int) STRING_LIMIT) \
{ \
if (bytes_in_chunk > 0) \
{ \
diff -rup orig/egcs-CVS20011007/gcc/toplev.c egcs-CVS20011007/gcc/toplev.c
--- orig/egcs-CVS20011007/gcc/toplev.c Sun Oct 7 16:30:17 2001
+++ egcs-CVS20011007/gcc/toplev.c Mon Oct 8 16:59:10 2001
@@ -959,7 +959,7 @@ debug_args[] =
{ 0, 0, 0, 0 }
};
-typedef struct
+typedef struct lang_independent_options
{
const char *string;
int *variable;