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

Eric Christopher echristo at gmail.com
Tue Sep 3 20:02:01 PDT 2013


On darwin you can only depend upon constructor priority order within
an individual module, not across modules. I'm not sure if that's
what's going on in your case, but it's been the cause before.

-eric

On Tue, Sep 3, 2013 at 6:42 PM, Jeffrey Walton <noloader at gmail.com> wrote:
> 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
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list