mirror of
https://github.com/postgres/postgres.git
synced 2026-07-15 12:51:05 -04:00
Disable extended alignment uses on older g++
Fix for commit a9bdb63bba. The previous plan of redefining alignas
didn't work, because it interfered with other C++ header files (e.g.,
LLVM). So now the new workaround is to just disable the affected
typedefs under the affected compilers. These are not typically used
in extensions anyway.
Discussion: https://www.postgresql.org/message-id/3119480.1769189606%40sss.pgh.pa.us
This commit is contained in:
parent
d9abd9e105
commit
6ceef9408c
1 changed files with 10 additions and 10 deletions
|
|
@ -262,16 +262,6 @@
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* alignas is buggy in g++ < 9, but the more or less equivalent attribute
|
|
||||||
* works.
|
|
||||||
*
|
|
||||||
* <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89357>
|
|
||||||
*/
|
|
||||||
#if defined(__cplusplus) && defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 9
|
|
||||||
#define alignas(a) __attribute__((aligned(a)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use "pg_attribute_always_inline" in place of "inline" for functions that
|
* Use "pg_attribute_always_inline" in place of "inline" for functions that
|
||||||
* we wish to force inlining of, even when the compiler's heuristics would
|
* we wish to force inlining of, even when the compiler's heuristics would
|
||||||
|
|
@ -1123,6 +1113,14 @@ typedef struct PGAlignedBlock
|
||||||
alignas(MAXIMUM_ALIGNOF) char data[BLCKSZ];
|
alignas(MAXIMUM_ALIGNOF) char data[BLCKSZ];
|
||||||
} PGAlignedBlock;
|
} PGAlignedBlock;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* alignas with extended alignments is buggy in g++ < 9. As a simple
|
||||||
|
* workaround, we disable these definitions in that case.
|
||||||
|
*
|
||||||
|
* <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89357>
|
||||||
|
*/
|
||||||
|
#if !(defined(__cplusplus) && defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 9)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use this to declare a field or local variable holding a page buffer, if that
|
* Use this to declare a field or local variable holding a page buffer, if that
|
||||||
* page might be accessed as a page or passed to an SMgr I/O function. If
|
* page might be accessed as a page or passed to an SMgr I/O function. If
|
||||||
|
|
@ -1142,6 +1140,8 @@ typedef struct PGAlignedXLogBlock
|
||||||
alignas(PG_IO_ALIGN_SIZE) char data[XLOG_BLCKSZ];
|
alignas(PG_IO_ALIGN_SIZE) char data[XLOG_BLCKSZ];
|
||||||
} PGAlignedXLogBlock;
|
} PGAlignedXLogBlock;
|
||||||
|
|
||||||
|
#endif /* !(g++ < 9) */
|
||||||
|
|
||||||
/* msb for char */
|
/* msb for char */
|
||||||
#define HIGHBIT (0x80)
|
#define HIGHBIT (0x80)
|
||||||
#define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT)
|
#define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue