http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57934
Bug ID: 57934
Summary: spurious definition of preprocessor CAT in
gcc-interface/ada.h for traditional (replaces ##)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: georggcc at googlemail dot com
IIUC, the definition of CAT in ada.h should replace a##b not
present in traditional C compilers. If still applicable, the
definition doesn't seem to work, though, perhaps because it
defines "_ECHO" but then uses "ECHO":
#ifdef __STDC__
#define CAT(A,B) A##B
#else
#define _ECHO(A) A
#define CAT(A,B) ECHO(A)B
#endif
$ cat test.c
#include "ada.h"
static int CAT(var,iable) = 42;
$ gcc -traditional -W -c -E -I ~/src/gcc/gcc/ada/gcc-interface test.c
# 1 "test.c"
# 1 "<command-line>"
# 1 "test.c"
# 1 "/Users/bauhaus/src/gcc/gcc/ada/gcc-interface/ada.h" 1
# 25 "/Users/bauhaus/src/gcc/gcc/ada/gcc-interface/ada.h"
...
# 2 "test.c" 2
static int ECHO(var)iable = 42;
Compilation finished at Fri Jul 19 11:43:12
Defining ECHO to be _ECHO produces the expected, catenated "variable".