https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68118
Bug ID: 68118 Summary: C preprocessor inserts whitespace after macro parameter substitution Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: harry.clauson at hyatt dot com Target Milestone: --- The following C macro appears to expand incorrectly: harry@slack32x:~$ cat test_whitespace.c #define my_mac(_name,_op,_val) _name _op=_val my_mac(i,|,4); my_mac(i,blah,4); Here is the gcc pre-processor output: harry@slack32x:~$ gcc -v -E -Wall -Wextra -std=c99 test_whitespace.c Using built-in specs. COLLECT_GCC=gcc Target: i686-pc-linux-gnu Configured with: ../gcc-5.2.0/configure --prefix=/home/harry/local --enable-languages=c,c++ Thread model: posix gcc version 5.2.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-E' '-Wall' '-Wextra' '-std=c99' '-mtune=generic' '-march=pentiumpro' /home/harry/local/libexec/gcc/i686-pc-linux-gnu/5.2.0/cc1 -E -quiet -v test_whitespace.c -mtune=generic -march=pentiumpro -std=c99 -Wall -Wextra ignoring nonexistent directory "/home/harry/local/lib/gcc/i686-pc-linux-gnu/5.2.0/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /home/harry/local/lib/gcc/i686-pc-linux-gnu/5.2.0/include /usr/local/include /home/harry/local/include /home/harry/local/lib/gcc/i686-pc-linux-gnu/5.2.0/include-fixed /usr/include End of search list. # 1 "test_whitespace.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "test_whitespace.c" i | =4; i blah=4; The expansion when _op = | appears to insert whitespace between the parameter value and the following token (=) which does not appear in the replacement list. When _op = blah, the expansion works as expected without inserting whitespace between the parameter and the following token (=). Thank you!