Skip to content

Commit afc1a52

Browse files
authored
Reduce Warnings - address -Wunused-macros warnings (#1935)
1 parent 6b8b81a commit afc1a52

30 files changed

+4
-335
lines changed

src/libbson/src/bson/bcon.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#define STACK_BSON_PARENT STACK_BSON (-1)
3939
#define STACK_BSON_CHILD STACK_BSON (0)
4040

41-
#define STACK_ITER_PARENT STACK_ITER (-1)
4241
#define STACK_ITER_CHILD STACK_ITER (0)
4342

4443
#define STACK_I STACK_ELE (0, i)

src/libbson/src/bson/bson-json.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,7 @@ _noop (void)
265265
#define STACK_BSON_CHILD STACK_BSON (0)
266266
#define STACK_I STACK_ELE (0, i)
267267
#define STACK_FRAME_TYPE STACK_ELE (0, type)
268-
#define STACK_IS_INITIAL (STACK_FRAME_TYPE == BSON_JSON_FRAME_INITIAL)
269268
#define STACK_IS_ARRAY (STACK_FRAME_TYPE == BSON_JSON_FRAME_ARRAY)
270-
#define STACK_IS_DOC (STACK_FRAME_TYPE == BSON_JSON_FRAME_DOC)
271269
#define STACK_IS_SCOPE (STACK_FRAME_TYPE == BSON_JSON_FRAME_SCOPE)
272270
#define STACK_IS_DBPOINTER (STACK_FRAME_TYPE == BSON_JSON_FRAME_DBPOINTER)
273271
#define FRAME_TYPE_HAS_BSON(_type) ((_type) == BSON_JSON_FRAME_SCOPE || (_type) == BSON_JSON_FRAME_DBPOINTER)

src/libbson/src/bson/bson-timegm.c

Lines changed: 2 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,10 @@
1818
#include <string.h>
1919
#include <stdint.h> /* for INT64_MAX and INT64_MIN */
2020

21-
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
22-
#define is_digit(c) ((unsigned) (c) - '0' <= 9)
23-
2421
#if 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
25-
#define ATTRIBUTE_CONST __attribute__ ((const))
2622
#define ATTRIBUTE_PURE __attribute__ ((__pure__))
27-
#define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
2823
#else
29-
#define ATTRIBUTE_CONST /* empty */
30-
#define ATTRIBUTE_PURE /* empty */
31-
#define ATTRIBUTE_FORMAT(spec) /* empty */
32-
#endif
33-
34-
#if !defined(__STDC_VERSION__) && !defined restrict
35-
#define restrict /* empty */
24+
#define ATTRIBUTE_PURE /* empty */
3625
#endif
3726

3827
#ifdef __clang__
@@ -79,88 +68,13 @@ static int64_t const time_t_max = INT64_MAX;
7968
#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
8069
#define MONSPERYEAR 12
8170

82-
#define TM_SUNDAY 0
83-
#define TM_MONDAY 1
84-
#define TM_TUESDAY 2
85-
#define TM_WEDNESDAY 3
86-
#define TM_THURSDAY 4
87-
#define TM_FRIDAY 5
88-
#define TM_SATURDAY 6
89-
90-
#define TM_JANUARY 0
91-
#define TM_FEBRUARY 1
92-
#define TM_MARCH 2
93-
#define TM_APRIL 3
94-
#define TM_MAY 4
95-
#define TM_JUNE 5
96-
#define TM_JULY 6
97-
#define TM_AUGUST 7
98-
#define TM_SEPTEMBER 8
99-
#define TM_OCTOBER 9
100-
#define TM_NOVEMBER 10
101-
#define TM_DECEMBER 11
102-
10371
#define TM_YEAR_BASE 1900
10472

10573
#define EPOCH_YEAR 1970
106-
#define EPOCH_WDAY TM_THURSDAY
74+
#define EPOCH_WDAY 4 /* TM_THURSDAY */
10775

10876
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
10977

110-
/*
111-
** Since everything in isleap is modulo 400 (or a factor of 400), we know that
112-
** isleap(y) == isleap(y % 400)
113-
** and so
114-
** isleap(a + b) == isleap((a + b) % 400)
115-
** or
116-
** isleap(a + b) == isleap(a % 400 + b % 400)
117-
** This is true even if % means modulo rather than Fortran remainder
118-
** (which is allowed by C89 but not C99).
119-
** We use this to avoid addition overflow problems.
120-
*/
121-
122-
#define isleap_sum(a, b) isleap ((a) % 400 + (b) % 400)
123-
124-
#ifndef TZ_ABBR_MAX_LEN
125-
#define TZ_ABBR_MAX_LEN 16
126-
#endif /* !defined TZ_ABBR_MAX_LEN */
127-
128-
#ifndef TZ_ABBR_CHAR_SET
129-
#define TZ_ABBR_CHAR_SET "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._"
130-
#endif /* !defined TZ_ABBR_CHAR_SET */
131-
132-
#ifndef TZ_ABBR_ERR_CHAR
133-
#define TZ_ABBR_ERR_CHAR '_'
134-
#endif /* !defined TZ_ABBR_ERR_CHAR */
135-
136-
#ifndef WILDABBR
137-
/*
138-
** Someone might make incorrect use of a time zone abbreviation:
139-
** 1. They might reference tzname[0] before calling tzset (explicitly
140-
** or implicitly).
141-
** 2. They might reference tzname[1] before calling tzset (explicitly
142-
** or implicitly).
143-
** 3. They might reference tzname[1] after setting to a time zone
144-
** in which Daylight Saving Time is never observed.
145-
** 4. They might reference tzname[0] after setting to a time zone
146-
** in which Standard Time is never observed.
147-
** 5. They might reference tm.TM_ZONE after calling offtime.
148-
** What's best to do in the above cases is open to debate;
149-
** for now, we just set things up so that in any of the five cases
150-
** WILDABBR is used. Another possibility: initialize tzname[0] to the
151-
** string "tzname[0] used before set", and similarly for the other cases.
152-
** And another: initialize tzname[0] to "ERA", with an explanation in the
153-
** manual page of what this "time zone abbreviation" means (doing this so
154-
** that tzname[0] has the "normal" length of three characters).
155-
*/
156-
#define WILDABBR " "
157-
#endif /* !defined WILDABBR */
158-
159-
#ifdef TM_ZONE
160-
static const char wildabbr[] = WILDABBR;
161-
static const char gmt[] = "GMT";
162-
#endif
163-
16478
struct ttinfo { /* time type information */
16579
int_fast32_t tt_gmtoff; /* UT offset in seconds */
16680
int tt_isdst; /* used to set tm_isdst */
@@ -206,10 +120,6 @@ struct rule {
206120
int_fast32_t r_time; /* transition time of rule */
207121
};
208122

209-
#define JULIAN_DAY 0 /* Jn - Julian day */
210-
#define DAY_OF_YEAR 1 /* n - day of year */
211-
#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */
212-
213123
/*
214124
** Prototypes for static functions.
215125
*/
@@ -286,14 +196,6 @@ gmtsub (const int64_t *const timep, const int_fast32_t offset, struct bson_tm *c
286196
gmtload (gmtptr);
287197
}
288198
result = timesub (timep, offset, gmtptr, tmp);
289-
#ifdef TM_ZONE
290-
/*
291-
** Could get fancy here and deliver something such as
292-
** "UT+xxxx" or "UT-xxxx" if offset is non-zero,
293-
** but this is no time for a treasure hunt.
294-
*/
295-
tmp->TM_ZONE = offset ? wildabbr : gmtptr ? gmtptr->chars : gmt;
296-
#endif /* defined TM_ZONE */
297199
return result;
298200
}
299201

0 commit comments

Comments
 (0)