[cfe-dev] Clang equivalent to __attribute__(init_priority)?

Jeffrey Walton noloader at gmail.com
Tue Sep 3 18:42:50 PDT 2013


I'm catching a crash due to a library's use of a global string. The
library provides it, and I [indirectly] consume it. I understand why
the crash happens and that's not a problem.

What's giving me trouble is __attribute__(init_priority) [1]. It does
not appear to be honored, and I'm not getting a warning about it (or a
failed compile like __attribute__(aligned)).

Is there anyway to force the construction of an object in Clang similar to GCC?

Thanks,

Jeff

[1] http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html

$ clang++ -v
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.4.0
Thread model: posix

$ echo | clang++ -dM -E - | grep GNU
#define __GNUC_MINOR__ 2
#define __GNUC_PATCHLEVEL__ 1
#define __GNUC_STDC_INLINE__ 1
#define __GNUC__ 4



More information about the cfe-dev mailing list