🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1489

GCU CPP fails to set macro as predefined if it is a predefinition.

#1489
From: Thomas A Peterson
Date: Mon, 28 Dec 1992 17:16
59 lines
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
Technical Details
Message-ID: <9212281716.AA13396@aristotle.src.honeywell.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!src.honeywell.com!tap

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!src.honeywell.com!tap
From: tap@src.honeywell.com (Thomas A Peterson)
Subject: GCU CPP fails to set macro as predefined if it is a predefinition.
Message-ID: <9212281716.AA13396@aristotle.src.honeywell.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 28 Dec 1992 17:16:30 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 61