Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Thomas A Peterson
Mon, 28 Dec 1992 17:16
GCU CPP fails to set macro as predefined if it is a predefinition.
Author: Thomas A Peterson
Date: Mon, 28 Dec 1992 17:16
Date: Mon, 28 Dec 1992 17:16
59 lines
2154 bytes
2154 bytes
gcc version: gcc-2.3.1
machine: sparc-sun-sunos4.1.1
Brief:
Those macros that are predefined, such as 'sparc 1', fail to have
their defn->predefined field set correctly.
Description:
In the function 'create_definition' in the file cccp.c there is the
following lines:
/* OP is null if this is a predefinition */
defn->predefined = !op;
Unfortunately, op does not come in as null when the macro is a
predefinition.
Here is the back trace:
(gdb) bt
#0 create_definition (buf=0xf7fff680 "sparc 1", limit=0xf7fff687 "", op=0x20fa8) at cccp.c:4772
#1 0xcc94 in do_define (buf=0xf7fff680 "sparc 1", limit=0xf7fff687 "", op=0x20fa8, keyword=0x1c380) at cccp.c:4808
#2 0x16280 in make_definition (str=0xf7fff70a "sparc", op=0x20fa8) at cccp.c:8333
#3 0x3ba0 in main (argc=2, argv=0xf7fff7fc) at cccp.c:1399
(gdb)
It appears to me that main() should call make_definition() with its
second argument as null when doing the standard defines, as shown
below.
/* Do standard #defines and assertions
that identify system and machine type. */
if (!inhibit_predefs) {
char *p = (char *) alloca (strlen (predefs) + 1);
strcpy (p, predefs);
while (*p) {
char *q;
while (*p == ' ' || *p == '\t')
p++;
/* Handle -D options. */
if (p[0] == '-' && p[1] == 'D') {
q = &p[2];
while (*p && *p != ' ' && *p != '\t')
p++;
if (*p != 0)
*p++= 0;
if (debug_output)
output_line_command (fp, &outbuf, 0, same_file);
/* make_definition (q, &outbuf); */
----> make_definition (q, NULL);
while (*p == ' ' || *p == '\t')
p++;
Tom
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads