linux-libc-headers: include/linux/compiler.h - do it the proper way

Jakub Bogusz qboosh w pld-linux.org
Pią, 22 Paź 2004, 18:53:17 CEST


On Fri, Oct 22, 2004 at 04:25:26PM +0000, mmazur wrote:
[...]
> +/*
> + * Allow us to avoid 'defined but not used' warnings on functions and data,
> + * as well as force them to be emitted to the assembly file.
> + *
> + * As of gcc 3.3, static functions that are not marked with attribute((used))
> + * may be elided from the assembly file.  As of gcc 3.3, static data not so
> + * marked will not be elided, but this may change in a future gcc version.
> + *
> + * In prior versions of gcc, such functions and data would be emitted, but
> + * would be warned about except with attribute((unused)).
> + */
> +#ifndef __attribute_used__
> +# define __attribute_used__	/* unimplemented */
> +#endif
[...]

itd.
To już przerabialiśmy.
Co jeśli inny kod zrobi tak samo (tzn. ifndef ... define ... endif),
tylko w tym #define będzie coś innego niż "unimplemented", potrzebnego
przy kompilacji?
Patrz komentarz do rev 1.4. tego pliku.

(brak __attribute__((used)) kiedy nie ma jawnych odwołań w C umożliwia
gcc optymalizację poprzez usunięcie wszelkich odwołań do
zmiennej/parametru albo samego ciała funkcji)


-- 
Jakub Bogusz    http://cyber.cs.net.pl/~qboosh/




Więcej informacji o liście dyskusyjnej pld-devel-pl