ax_gcc_var_attribute

Synopsis

AX_GCC_VAR_ATTRIBUTE(ATTRIBUTE)

Description

This macro checks if the compiler supports one of GCC’s variable attributes; many other compilers also provide variable attributes with the same syntax. Compiler warnings are used to detect supported attributes as unsupported ones are ignored by default so quieting warnings when using this macro will yield false positives.

The ATTRIBUTE parameter holds the name of the attribute to be checked.

If ATTRIBUTE is supported define HAVE_VAR_ATTRIBUTE_<ATTRIBUTE>.

The macro caches its result in the ax_cv_have_var_attribute_<attribute> variable.

The macro currently supports the following variable attributes:

 aligned
 cleanup
 common
 nocommon
 deprecated
 mode
 packed
 tls_model
 unused
 used
 vector_size
 weak
 dllimport
 dllexport
 init_priority

Unsupported variable attributes will be tested against a global integer variable and without any arguments given to the attribute itself; the result of this check might be wrong or meaningless so use with care.

Source Code

Download the latest version of ax_gcc_var_attribute.m4 or browse the macro’s revision history.

License

Copyright © 2013 Gabriele Svelto 

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.