[PROPOSED] Port alignof to Oracle Developer Studio
* zic.c (alignof): Don’t include <stdalign.h> when compiling with Oracle Developer Studio, as release 12.6 lacks <stdalign.h> even though it #defines __STDC_VERSION__ to 201112L. Most likely this circa-2017 release, which #defines __SUNPRO_C to be 0x5150, is the last release, so assume that all releases lack <stdalign.h>. --- zic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zic.c b/zic.c index f143fcef..5612805f 100644 --- a/zic.c +++ b/zic.c @@ -67,7 +67,7 @@ enum { FORMAT_LEN_GROWTH_BOUND = 5 }; #endif /* The minimum alignment of a type, for pre-C23 platforms. */ -#if __STDC_VERSION__ < 201112 +#if __STDC_VERSION__ < 201112 || defined __SUNPRO_C # define alignof(type) offsetof(struct { char a; type b; }, b) #elif __STDC_VERSION__ < 202311 # include <stdalign.h> -- 2.37.2
On Dec 1, 2022, at 1:01 PM, Paul Eggert via tz <tz@iana.org> wrote:
/* The minimum alignment of a type, for pre-C23 platforms. */ -#if __STDC_VERSION__ < 201112 +#if __STDC_VERSION__ < 201112 || defined __SUNPRO_C
Should this note why you're checking for __SUNPRO_C, so you don't have to "git bisect" or whatever to find the commit in which that was added, and then look t its commit log?
participants (2)
-
Guy Harris -
Paul Eggert