home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / gcc / bug / 3070 < prev    next >
Encoding:
Text File  |  1992-12-29  |  2.0 KB  |  74 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!src.honeywell.com!tap
  3. From: tap@src.honeywell.com (Thomas A Peterson)
  4. Subject: GCU CPP fails to set macro as predefined if it is a predefinition.
  5. Message-ID: <9212281716.AA13396@aristotle.src.honeywell.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Mon, 28 Dec 1992 17:16:30 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 61
  12.  
  13. gcc version: gcc-2.3.1
  14.  
  15. machine: sparc-sun-sunos4.1.1
  16.  
  17. Brief:
  18.  
  19.   Those macros that are predefined, such as 'sparc 1', fail to have
  20.   their defn->predefined field set correctly.
  21.  
  22. Description:
  23.  
  24.   In the function 'create_definition' in the file cccp.c there is the
  25.   following lines:
  26.  
  27.     /* OP is null if this is a predefinition */
  28.     defn->predefined = !op;
  29.  
  30.   Unfortunately, op does not come in as null when the macro is a
  31.   predefinition.
  32.  
  33.   Here is the back trace:
  34.  
  35.     (gdb) bt
  36.     #0  create_definition (buf=0xf7fff680 "sparc 1", limit=0xf7fff687 "", op=0x20fa8) at cccp.c:4772
  37.     #1  0xcc94 in do_define (buf=0xf7fff680 "sparc 1", limit=0xf7fff687 "", op=0x20fa8, keyword=0x1c380) at cccp.c:4808
  38.     #2  0x16280 in make_definition (str=0xf7fff70a "sparc", op=0x20fa8) at cccp.c:8333
  39.     #3  0x3ba0 in main (argc=2, argv=0xf7fff7fc) at cccp.c:1399
  40.     (gdb) 
  41.  
  42.   It appears to me that main() should call make_definition() with its
  43.   second argument as null when doing the standard defines, as shown
  44.   below.
  45.  
  46.   /* Do standard #defines and assertions
  47.      that identify system and machine type.  */
  48.  
  49.   if (!inhibit_predefs) {
  50.     char *p = (char *) alloca (strlen (predefs) + 1);
  51.     strcpy (p, predefs);
  52.     while (*p) {
  53.       char *q;
  54.       while (*p == ' ' || *p == '\t')
  55.     p++;
  56.       /* Handle -D options.  */ 
  57.       if (p[0] == '-' && p[1] == 'D') {
  58.     q = &p[2];
  59.     while (*p && *p != ' ' && *p != '\t')
  60.       p++;
  61.     if (*p != 0)
  62.       *p++= 0;
  63.     if (debug_output)
  64.       output_line_command (fp, &outbuf, 0, same_file);
  65.     /* make_definition (q, &outbuf); */
  66. ---->    make_definition (q, NULL);
  67.     while (*p == ' ' || *p == '\t')
  68.       p++;
  69.  
  70.  
  71. Tom
  72.  
  73.  
  74.