This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Macro causes an error


I've declared some macros, but it want not work, don't
know why. The preprocessor produces correct code.
Im using gcc version 3.1 20020415 (prerelease).

------ macros <handler.h>:

#define OUTPUTARGS(...)          :__VA_ARGS__
#define INPUTARGS(...)           :__VA_ARGS__
#define CLOBBEREDARGS(...)       :__VA_ARGS__
#define START(x)                 asm("\t.text\n"\
                                 "\t.align 2\n" \
                                 ".globl _" x "\n" \
                                 "_" x ":\n"
#define END(x,y, ...)            x y "\n" __VA_ARGS__);
#define INT                      "\tiret "

---- gcc code:

START("PAGE_FAULT_HANDLER")
  "\tmov eax,1\n"
END(INT,"4",OUTPUTARGS("=r"(a)))


Compiler output: 6: parse error before ':' token

---- cpp produces:

# 1 "E:/OS/aos/source/kernel/test2.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "E:/OS/aos/source/kernel/test2.c"
# 1 "E:/OS/aos/source/kernel/handler.h" 1
# 2 "E:/OS/aos/source/kernel/test2.c" 2
int a;

 asm("\t.text\n" "\t.align 2\n" ".globl _" "PAGE_FAULT_HANDLER" "\n" 
     "_" "PAGE_FAULT_HANDLER" ":\n"
     "\tmov eax,1\n"
     "\tiret " "4" "\n" :"=r"(a));

----

What is the problem here?

regards
Benjamin 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]