__attribute__ ((regparm(...))) in function declaration and gcc 3.4.0
Nicholas Nethercote
njn25@cam.ac.uk
Sun Feb 29 23:05:00 GMT 2004
On Sun, 29 Feb 2004, Serge Belyshev wrote:
> Why this fails to compile with gcc 3.4.0 (i686-pc-linux-gnu, 20030229)?
>
> $ cat > test.h
> int plus (int a, int b) __attribute__ ((regparm (2)));
> $ cat > test.c
> #include "test.h"
>
> int plus (int a, int b)
> {
> return a + b;
> }
> $ gcc -c test.c
> test.c:4: error: conflicting types for 'plus'
> test.h:1: error: previous declaration of 'plus' was here
> test.c:4: error: conflicting types for 'plus'
> test.h:1: error: previous declaration of 'plus' was here
Try adding the __attribute__((regparm(2))) to the function definition as
well. It seems this behaviour is new with 3.4.0.
N
More information about the Gcc
mailing list