Sylvain Beucler wrote: > Here's the version: > $ gcc --version > gcc (GCC) 4.2.3 20071123 (prerelease) (Debian 4.2.2-4) > > Here's how the test is compiled: > freedink/native/src$ LANG=C make test.o > gcc ... -std=c99 ...
Thanks for these. So the problem is that if __STRICT_ANSI__ is set, __attribute__(...) gets defined to empty. In some tests with GCC versions starting from 2.95.3, I found that __attribute__ works also with __STRICT_ANSI__, therefore there is no need to define it away. The test program was this: ================================================================================= #ifndef __attribute__ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif #endif typedef int int8_t __attribute__ ((__mode__ (__QI__))); extern void halt (void) __attribute__ ((__noreturn__)); int verify [2 * (sizeof (int8_t) == 1) - 1]; ================================================================================= I propose this patch: --- lib/argp-fmtstream.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/argp-fmtstream.h 2008-01-11 01:52:39.000000000 +0100 @@ -1,5 +1,5 @@ /* Word-wrapping and line-truncating streams. - Copyright (C) 1997, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1997, 2006-2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader <[EMAIL PROTECTED]>. @@ -30,7 +30,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes --- lib/argp.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/argp.h 2008-01-11 01:53:01.000000000 +0100 @@ -1,5 +1,5 @@ /* Hierarchial argument parsing, layered over getopt. - Copyright (C) 1995-1999,2003-2007 Free Software Foundation, Inc. + Copyright (C) 1995-1999,2003-2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader <[EMAIL PROTECTED]>. @@ -36,7 +36,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes --- lib/c-stack.c.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/c-stack.c 2008-01-11 01:51:08.000000000 +0100 @@ -1,6 +1,6 @@ /* Stack overflow handling. - Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ #include <config.h> #ifndef __attribute__ -# if __GNUC__ < 3 || __STRICT_ANSI__ +# if __GNUC__ < 3 # define __attribute__(x) # endif #endif --- lib/error.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/error.h 2008-01-11 01:53:27.000000000 +0100 @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes --- lib/fts.c.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/fts.c 2008-01-11 01:51:29.000000000 +0100 @@ -1,6 +1,6 @@ /* Traverse a file hierarchy. - Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -120,7 +120,7 @@ #endif #ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(x) /* empty */ # endif #endif --- lib/openat.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/openat.h 2008-01-11 01:53:42.000000000 +0100 @@ -1,5 +1,5 @@ /* provide a replacement openat function - Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ #include <stdbool.h> #ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(x) /* empty */ # endif #endif --- lib/stdio.in.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/stdio.in.h 2008-01-11 01:54:14.000000000 +0100 @@ -1,6 +1,6 @@ /* A GNU-like <stdio.h>. - Copyright (C) 2004, 2007 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes --- lib/string.in.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/string.in.h 2008-01-11 01:54:25.000000000 +0100 @@ -27,7 +27,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The attribute __pure__ was added in gcc 2.96. */ --- lib/utimens.c.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/utimens.c 2008-01-11 01:52:23.000000000 +0100 @@ -1,6 +1,6 @@ /* Set file access and modification times. - Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it @@ -54,7 +54,7 @@ #endif #ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(x) # endif #endif --- lib/vasnprintf.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/vasnprintf.h 2008-01-11 01:54:41.000000000 +0100 @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes --- lib/xalloc.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/xalloc.h 2008-01-11 01:54:56.000000000 +0100 @@ -1,7 +1,7 @@ /* xalloc.h -- malloc with out-of-memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + 1999, 2000, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ # ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(x) # endif # endif --- lib/xprintf.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/xprintf.h 2008-01-11 01:55:16.000000000 +0100 @@ -1,5 +1,5 @@ /* printf wrappers that fail immediately for non-file-related errors - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes --- lib/xstrtol.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/xstrtol.h 2008-01-11 01:55:40.000000000 +0100 @@ -1,7 +1,7 @@ /* A more useful interface to strtol. - Copyright (C) 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004, 2006, 2007 - Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004, 2006, 2007, + 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ _DECLARE_XSTRTOL (xstrtoumax, uintmax_t) #ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(x) # endif #endif --- lib/xvasprintf.h.orig 2008-01-11 03:17:47.000000000 +0100 +++ lib/xvasprintf.h 2008-01-11 01:55:54.000000000 +0100 @@ -1,5 +1,5 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes