[CDRIVER-1562] GCC6 pedantic warning Created: 26/Sep/16  Updated: 03/May/17  Resolved: 27/Sep/16

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jeroen Ooms [X] Assignee: Hannes Magnusson
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

bson/bson-timegm.c:66:5: warning: initializer element is not a constant expression [-Wpedantic]
     (TYPE_SIGNED(time_t)
     ^
bson/bson-timegm.c:70:5: warning: initializer element is not a constant expression [-Wpedantic]
     (TYPE_SIGNED(time_t)
     ^



 Comments   
Comment by Hannes Magnusson [ 27/Sep/16 ]

/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
It is necessary at least when t == time_t. */
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))

https://opensource.apple.com/source/gnutar/gnutar-410.1/tar/lib/mktime.c

this file, and snippets from it, are part of pretty much all software you'll encounter.

I'm not eager to modify it and breaking it. Especially since "fixing" the warning breaks other compilers.

Generated at Wed Feb 07 21:12:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.