[tz] [PROPOSED] Port alignof to Oracle Developer Studio

Paul Eggert eggert at cs.ucla.edu
Thu Dec 1 21:01:19 UTC 2022


* 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



More information about the tz mailing list