Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d3587d

Browse files
committed
Fix most -Wundef warnings
In some cases #if was used instead of #ifdef in an inconsistent style.Cleaning this up also helps when analyzing cases like38d8dce where this makes adifference.There are no behavior changes here, but the change in pg_bswap.h wouldprevent possible accidental misuse by third-party code.Discussion:https://www.postgresql.org/message-id/flat/3b615ca5-c595-3f1d-fdf7-a429e564f614%402ndquadrant.com
1 parent48cc59e commit5d3587d

File tree

11 files changed

+27
-19
lines changed

11 files changed

+27
-19
lines changed

‎contrib/hstore/hstore_compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ hstoreUpgrade(Datum orig)
299299

300300
if (valid_new)
301301
{
302-
#ifHSTORE_IS_HSTORE_NEW
302+
#ifdefHSTORE_IS_HSTORE_NEW
303303
elog(WARNING,"ambiguous hstore value resolved as hstore-new");
304304

305305
/*

‎contrib/pg_standby/pg_standby.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ CustomizableInitialize(void)
145145
switch (restoreCommandType)
146146
{
147147
caseRESTORE_COMMAND_LINK:
148-
#ifHAVE_WORKING_LINK
148+
#ifdefHAVE_WORKING_LINK
149149
SET_RESTORE_COMMAND("ln -s -f",WALFilePath,xlogFilePath);
150150
break;
151151
#endif

‎contrib/pgcrypto/imath.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,12 +2361,12 @@ s_ucmp(mp_int a, mp_int b)
23612361
staticint
23622362
s_vcmp(mp_inta,mp_smallv)
23632363
{
2364-
#if_MSC_VER
2364+
#ifdef_MSC_VER
23652365
#pragma warning(push)
23662366
#pragma warning(disable: 4146)
23672367
#endif
23682368
mp_usmalluv= (v<0) ?-(mp_usmall)v : (mp_usmall)v;
2369-
#if_MSC_VER
2369+
#ifdef_MSC_VER
23702370
#pragma warning(pop)
23712371
#endif
23722372

‎src/backend/libpq/be-fsstubs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ be_lo_open(PG_FUNCTION_ARGS)
9595
LargeObjectDesc*lobjDesc;
9696
intfd;
9797

98-
#ifFSDB
98+
#ifdefFSDB
9999
elog(DEBUG4,"lo_open(%u,%d)",lobjId,mode);
100100
#endif
101101

@@ -118,7 +118,7 @@ be_lo_close(PG_FUNCTION_ARGS)
118118
(errcode(ERRCODE_UNDEFINED_OBJECT),
119119
errmsg("invalid large-object descriptor: %d",fd)));
120120

121-
#ifFSDB
121+
#ifdefFSDB
122122
elog(DEBUG4,"lo_close(%d)",fd);
123123
#endif
124124

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,7 @@ typedef struct RewriteMappingFile
32473247
charfname[MAXPGPATH];
32483248
}RewriteMappingFile;
32493249

3250-
#ifNOT_USED
3250+
#ifdefNOT_USED
32513251
staticvoid
32523252
DisplayMapping(HTAB*tuplecid_data)
32533253
{

‎src/backend/storage/file/fd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ durable_link_or_rename(const char *oldfile, const char *newfile, int elevel)
738738
if (fsync_fname_ext(oldfile, false, false,elevel)!=0)
739739
return-1;
740740

741-
#ifHAVE_WORKING_LINK
741+
#ifdefHAVE_WORKING_LINK
742742
if (link(oldfile,newfile)<0)
743743
{
744744
ereport(elevel,

‎src/backend/utils/hash/dynahash.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ struct HTAB
243243
*/
244244
#defineMOD(x,y) ((x) & ((y)-1))
245245

246-
#ifHASH_STATISTICS
246+
#ifdefHASH_STATISTICS
247247
staticlonghash_accesses,
248248
hash_collisions,
249249
hash_expansions;
@@ -706,7 +706,7 @@ init_htab(HTAB *hashp, long nelem)
706706
/* Choose number of entries to allocate at a time */
707707
hctl->nelem_alloc=choose_nelem_alloc(hctl->entrysize);
708708

709-
#ifHASH_DEBUG
709+
#ifdefHASH_DEBUG
710710
fprintf(stderr,"init_htab:\n%s%p\n%s%ld\n%s%ld\n%s%d\n%s%ld\n%s%u\n%s%x\n%s%x\n%s%ld\n",
711711
"TABLE POINTER ",hashp,
712712
"DIRECTORY SIZE ",hctl->dsize,
@@ -832,7 +832,7 @@ hash_destroy(HTAB *hashp)
832832
void
833833
hash_stats(constchar*where,HTAB*hashp)
834834
{
835-
#ifHASH_STATISTICS
835+
#ifdefHASH_STATISTICS
836836
fprintf(stderr,"%s: this HTAB -- accesses %ld collisions %ld\n",
837837
where,hashp->hctl->accesses,hashp->hctl->collisions);
838838

@@ -933,7 +933,7 @@ hash_search_with_hash_value(HTAB *hashp,
933933
HASHBUCKET*prevBucketPtr;
934934
HashCompareFuncmatch;
935935

936-
#ifHASH_STATISTICS
936+
#ifdefHASH_STATISTICS
937937
hash_accesses++;
938938
hctl->accesses++;
939939
#endif
@@ -988,7 +988,7 @@ hash_search_with_hash_value(HTAB *hashp,
988988
break;
989989
prevBucketPtr=&(currBucket->link);
990990
currBucket=*prevBucketPtr;
991-
#ifHASH_STATISTICS
991+
#ifdefHASH_STATISTICS
992992
hash_collisions++;
993993
hctl->collisions++;
994994
#endif
@@ -1130,7 +1130,7 @@ hash_update_hash_key(HTAB *hashp,
11301130
HASHBUCKET*oldPrevPtr;
11311131
HashCompareFuncmatch;
11321132

1133-
#ifHASH_STATISTICS
1133+
#ifdefHASH_STATISTICS
11341134
hash_accesses++;
11351135
hctl->accesses++;
11361136
#endif
@@ -1204,7 +1204,7 @@ hash_update_hash_key(HTAB *hashp,
12041204
break;
12051205
prevBucketPtr=&(currBucket->link);
12061206
currBucket=*prevBucketPtr;
1207-
#ifHASH_STATISTICS
1207+
#ifdefHASH_STATISTICS
12081208
hash_collisions++;
12091209
hctl->collisions++;
12101210
#endif

‎src/backend/utils/mmgr/freepage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static void FreePagePushSpanLeader(FreePageManager *fpm, Size first_page,
164164
staticSizeFreePageManagerLargestContiguous(FreePageManager*fpm);
165165
staticvoidFreePageManagerUpdateLargest(FreePageManager*fpm);
166166

167-
#ifFPM_EXTRA_ASSERTS
167+
#ifdefFPM_EXTRA_ASSERTS
168168
staticSizesum_free_pages(FreePageManager*fpm);
169169
#endif
170170

‎src/include/port/pg_bswap.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,14 @@ pg_bswap64(uint64 x)
139139
* the same result as a memcmp() of the corresponding original Datums, but can
140140
* be much cheaper. It's generally safe to do this on big-endian systems
141141
* without any special transformation occurring first.
142+
*
143+
* If SIZEOF_DATUM is not defined, then postgres.h wasn't included and these
144+
* macros probably shouldn't be used, so we define nothing. Note that
145+
* SIZEOF_DATUM == 8 would evaluate as 0 == 8 in that case, potentially
146+
* leading to the wrong implementation being selected and confusing errors, so
147+
* defining nothing is safest.
142148
*/
149+
#ifdefSIZEOF_DATUM
143150
#ifdefWORDS_BIGENDIAN
144151
#defineDatumBigEndianToNative(x)(x)
145152
#else/* !WORDS_BIGENDIAN */
@@ -149,5 +156,6 @@ pg_bswap64(uint64 x)
149156
#defineDatumBigEndianToNative(x)pg_bswap32(x)
150157
#endif/* SIZEOF_DATUM == 8 */
151158
#endif/* WORDS_BIGENDIAN */
159+
#endif/* SIZEOF_DATUM */
152160

153161
#endif/* PG_BSWAP_H */

‎src/port/snprintf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ fmtint(long long value, char type, int forcesign, int leftjust,
10521052
}
10531053

10541054
/* disable MSVC warning about applying unary minus to an unsigned value */
1055-
#if_MSC_VER
1055+
#ifdef_MSC_VER
10561056
#pragma warning(push)
10571057
#pragma warning(disable: 4146)
10581058
#endif
@@ -1061,7 +1061,7 @@ fmtint(long long value, char type, int forcesign, int leftjust,
10611061
uvalue=-(unsigned long long)value;
10621062
else
10631063
uvalue= (unsigned long long)value;
1064-
#if_MSC_VER
1064+
#ifdef_MSC_VER
10651065
#pragma warning(pop)
10661066
#endif
10671067

‎src/port/win32error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ _dosmaperr(unsigned long e)
188188
ereport(DEBUG5,
189189
(errmsg_internal("mapped win32 error code %lu to %d",
190190
e,doserr)));
191-
#elifFRONTEND_DEBUG
191+
#elifdefined(FRONTEND_DEBUG)
192192
fprintf(stderr,"mapped win32 error code %lu to %d",e,doserr);
193193
#endif
194194
errno=doserr;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp