This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] toplev.c: Guard the use of target_options.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: geoffk at apple dot com
- Date: Sun, 26 Oct 2003 10:40:30 -0500 (EST)
- Subject: [patch] toplev.c: Guard the use of target_options.
Hi,
Attached is a patch to guard the use of target_options with #ifdef
TARGET_OPTIONS.
http://gcc.gnu.org/ml/gcc-patches/2003-10/msg02254.html
causes a build failure of h8300 port. This is due to the use of
target_options without "#ifdef TARGET_OPTIONS". The patch fixes the
problem by putting appropriate #ifdefs.
Tested on h8300 port. Committed as obvious.
Kazu Hirata
2003-10-26 Kazu Hirata <kazu@cs.umass.edu>
* toplev.c (default_get_pch_validity): Guard the use of
target_options with #ifdef TARGET_OPTIONS.
(default_pch_valid_p): Likewise.
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.840
diff -u -8 -p -r1.840 toplev.c
--- toplev.c 26 Oct 2003 06:47:16 -0000 1.840
+++ toplev.c 26 Oct 2003 15:29:55 -0000
@@ -4105,40 +4105,44 @@ init_asm_output (const char *name)
void *
default_get_pch_validity (size_t *len)
{
size_t i;
char *result, *r;
*len = sizeof (target_flags) + 2;
+#ifdef TARGET_OPTIONS
for (i = 0; i < ARRAY_SIZE (target_options); i++)
{
*len += 1;
if (*target_options[i].variable)
*len += strlen (*target_options[i].variable);
}
+#endif
result = r = xmalloc (*len);
r[0] = flag_pic;
r[1] = flag_pie;
r += 2;
memcpy (r, &target_flags, sizeof (target_flags));
r += sizeof (target_flags);
+#ifdef TARGET_OPTIONS
for (i = 0; i < ARRAY_SIZE (target_options); i++)
{
const char *str = *target_options[i].variable;
size_t l;
if (! str)
str = "";
l = strlen (str) + 1;
memcpy (r, str, l);
r += l;
}
+#endif
return result;
}
/* Default version of pch_valid_p. */
const char *
default_pch_valid_p (const void *data_p, size_t len)
@@ -4174,31 +4178,33 @@ default_pch_valid_p (const void *data_p,
}
}
abort ();
}
data += sizeof (target_flags);
len -= sizeof (target_flags);
/* Check string options. */
+#ifdef TARGET_OPTIONS
for (i = 0; i < ARRAY_SIZE (target_options); i++)
{
const char *str = *target_options[i].variable;
size_t l;
if (! str)
str = "";
l = strlen (str) + 1;
if (len < l || memcmp (data, str, l) != 0)
{
flag_that_differs = target_options[i].prefix;
goto make_message;
}
data += l;
len -= l;
}
+#endif
return NULL;
make_message:
{
char *r;
asprintf (&r, _("created and used with differing settings of `-m%s'"),
flag_that_differs);