Karim BELABAS on Sun, 13 Oct 2002 16:20:52 +0200 (MEST)

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: annoying warnings

On Sun, 13 Oct 2002, Bill Allombert wrote:
> On Thu, Oct 10, 2002 at 06:44:46PM -0400, Igor Schein wrote:
> > ../src/kernel/ix86/l0asm.c:104:1: warning: pasting "addll" and ":" does not give a valid preprocessing token
> The problem is that we lie to CPP about the nature of the file:
> we present it as a C file but src/kernel/ix86/l0asm.c is really an assembly
> file:
> The warning are due to some asm construct being valid but not corresponding
> to a valid C construct.

This warning looks a bit far fetched, though.

1) we could be expanding macros within the scope of gcc's asm (or __asm__)
extension in a regular C file.

2) Actually, 'addll:' _is_ a valid C construct [ label for goto or switch
statements ], isn't it ?

> There is two work around:
> --- Either rename the file l0asm.S but this is not portable since a lot of C
> compilers (GCC include) would not process files with an unknow extension
> without some special directives.
> --- Pass "-x assembler-with-cpp" to cpp, which is not portable.

There's another solution: replace the ANSI C token concatenation ## by the
old /**/ kludge

#define FUNBEGIN(name) C(name/**/:)

also suppresses the warning. It is ugly, but portable I think [ never met an
ANSI C or C++ compiler that rejected this ].

Karim Belabas                    Tel: (+33) (0)1 69 15 57 48
Dép. de Mathematiques, Bat. 425  Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud             Email: Karim.Belabas@math.u-psud.fr
F-91405 Orsay (France)           http://www.math.u-psud.fr/~belabas/
PARI/GP Home Page: http://www.parigp-home.de/