https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99073

            Bug ID: 99073
           Summary: Preprocessing with -CC adds unwanted junk
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

This code:

#define TEST_CODE( \
   PARAM_01, \
   PARAM_02, \
   PARAM_03, \
   PARAM_04) \
void function_name(PARAM_01 arg) { /*
*/  line_one; /*
*/  line two; /*
*/  PARAM_03; /*
*/}

TEST_CODE( \
     param_value_01, \
     param_value_02, \
     param_value_03, \
     param_value_04)


When preprocessed with "gcc -E -nostdinc -CC" produces the following:

# 1 "test.h"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.h"
# 15 "test.h"
void function_name(param_value_01 arg) { /*
arg) { /*
*/
# 15 "test.h"
 line_one; /*
*/
# 15 "test.h"
 line two; /*
*/
# 15 "test.h"
 param_value_03; /*
*/}


The "arg) { /*" shouldn't be there.

(The -nostdinc isn't relevant to the bug, it just avoids including the comments
in std-predef.h in the output)

With -P to reduce the noise of the line markers:

$ gcc -E -CC test.h -nostdinc -P
void function_name(param_value_01 arg) { /*
arg) { /*
*/ line_one; /*
*/ line two; /*
*/ param_value_03; /*
*/}

Reply via email to