Skip to content

Commit a93f397

Browse files
committed
On architectures where we don't have any special inline code for
GCC, the inner "#if defined(__GNUC__)" can just be omitted in that architecture's block. The existing arrangement with an outer "#if defined(__GNUC__)" doesn't have any obvious benefit, and it encourages missed cases like this one. BTW, I'd suggest making the definition of clear_lock for HPUX be static const slock_t clear_lock = {{-1, -1, -1, -1}}; The extra braces are needed to suppress warnings from gcc, and declaring it const just seems like good practice. regards, tom lane
1 parent b474664 commit a93f397

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

src/include/storage/s_lock.h

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.37 1998/07/18 14:38:12 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.38 1998/07/18 14:51:10 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -230,24 +230,6 @@ tas(volatile slock_t *lock)
230230

231231

232232

233-
#if defined(__hpux)
234-
/*
235-
* HP-UX (PA-RISC)
236-
*
237-
* Note that slock_t on PA-RISC is a structure instead of char
238-
* (see storage/ipc.h).
239-
*
240-
* a "set" slock_t has a single word cleared. a "clear" slock_t has
241-
* all words set to non-zero. tas() in tas.s
242-
*/
243-
static slock_t clear_lock =
244-
{-1, -1, -1, -1};
245-
246-
#define S_UNLOCK(lock) (*(lock) = clear_lock) /* struct assignment */
247-
#define S_LOCK_FREE(lock) ( *(int *) (((long) (lock) + 15) & ~15) != 0)
248-
#endif /* __hpux */
249-
250-
251233

252234
#if defined(NEED_I386_TAS_ASM)
253235
/* non gcc i386 based things */
@@ -277,7 +259,22 @@ tas(slock_t *s_lock)
277259

278260
#endif /* else defined(__GNUC__) */
279261

262+
#if defined(__hpux)
263+
/*
264+
* HP-UX (PA-RISC)
265+
*
266+
* Note that slock_t on PA-RISC is a structure instead of char
267+
* (see storage/ipc.h).
268+
*
269+
* a "set" slock_t has a single word cleared. a "clear" slock_t has
270+
* all words set to non-zero. tas() in tas.s
271+
*/
272+
static const slock_t clear_lock =
273+
{{-1, -1, -1, -1}};
280274

275+
#define S_UNLOCK(lock) (*(lock) = clear_lock) /* struct assignment */
276+
#define S_LOCK_FREE(lock) ( *(int *) (((long) (lock) + 15) & ~15) != 0)
277+
#endif /* __hpux */
281278

282279

283280
/****************************************************************************

0 commit comments

Comments
 (0)