Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit bd57c3a

Browse files
author
Bryan Henderson
committed
Quiet compiler warnings about missing prototypes in Linux's bitops.h.
1 parent 435d4f4 commit bd57c3a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/backend/port/linux/asm/bitops.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* This is a hack that lets us use the -Wmissing-prototypes compile option.
2+
3+
A bug or weakness in Linux's asm/bitops.h file makes it define a bunch
4+
of inline functions without first declaring a prototype. This causes
5+
-Wmissing-prototypes to generate warnings. These warnings are distracting
6+
and, in the case of -Werror, fatal.
7+
8+
asm/bitops.h gets included by the Linux C library sem.h, which is included
9+
in several Postgres backend source files.
10+
11+
Until Linux is fixed, we have our own version of asm/bitops.h that gets
12+
included first because it is in a directory mentioned in a -I option,
13+
whereas the Linux asm/bitops.h is in a standard include directory. (This
14+
is GNU C preprocessor function).
15+
16+
Our asm/bitops.h declares prototypes and then includes the Linux
17+
asm/bitops.h. If Linux changes these functions, our asm/bitops.h will
18+
stop compiling and will have to be updated.
19+
20+
-Bryan 1996.11.17
21+
*/
22+
23+
#ifndef POSTGRES_BITOPS_H
24+
#define POSTGRES_BITOPS_H
25+
26+
#ifdef __SMP__
27+
#define PG_BITOPS_VOLATILE volatile
28+
#else
29+
#define PG_BITOPS_VOLATILE
30+
#endif
31+
32+
extern __inline__ int set_bit(int nr, PG_BITOPS_VOLATILE void * addr);
33+
extern __inline__ int clear_bit(int nr, PG_BITOPS_VOLATILE void * addr);
34+
extern __inline__ int change_bit(int nr, PG_BITOPS_VOLATILE void * addr);
35+
extern __inline__ int test_bit(int nr, const PG_BITOPS_VOLATILE void * addr);
36+
extern __inline__ int find_first_zero_bit(void * addr, unsigned size);
37+
extern __inline__ int find_next_zero_bit (void * addr, int size, int offset);
38+
extern __inline__ unsigned long ffz(unsigned long word);
39+
40+
#include_next <asm/bitops.h>
41+
#endif

0 commit comments

Comments
 (0)