summaryrefslogtreecommitdiff
path: root/compiler-tests.h
Commit message (Collapse)AuthorAgeFilesLines
* Make the tests a bit easier to read.Guy Harris2021-08-111-23/+40
| | | | | | | | | | Add comments and indentation. Handle XL C a bit more like the other compilers. Make the first test be "is this someting that's not XL C", as is the case for other compilers; that test is done as "are both __xlC__ and __ibmxl__ undefined". If either of them are defined, use __ibmxl_version__ if __ibmxl__ is defined, and use __xlC__ otherwise.
* Define PRINTFLIKE_FUNCPTR() exactly for XL C. [skip appveyor]Denis Ovsienko2021-08-031-0/+7
| | | | | | | | XL C full version consists of 4 numbers. Introduce an additional macro for testing the two least significant numbers. Using the fix lists published by IBM, tell XL C 16.1 that has the bug interpreting the __format__ attribute of a function pointer from XL C 16.1 that has not. Rejig the #if block to make it easier to follow.
* Address some issues with XL C on Linux/POWER9.Denis Ovsienko2021-07-271-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | XL C 16.1.1 Community Edition for Linux generated three warnings for every file: In file included from ./tcpdump.c:155: ./netdissect.h:254:8: warning: 1540-2990 The attribute "__attribute__((format(printf, 2, 3)))" is not supported. The attribute is ignored. PRINTFLIKE_FUNCPTR(2, 3); ^ ./netdissect.h:259:10: warning: 1540-2990 The attribute " __attribute__((format(printf, 3, 4)))" is not supported. The attribute is ignored. PRINTFLIKE_FUNCPTR(3, 4); ^ ./netdissect.h:263:9: warning: 1540-2990 The attribute " __attribute__((format(printf, 2, 3)))" is not supported. The attribute is ignored. PRINTFLIKE_FUNCPTR(2, 3); ^ As it turns out, this is a bug in the compiler. In compiler-tests.h update ND_IS_AT_LEAST_XL_C_VERSION() to tell newer XL C versions. In funcattrs.h exempt XL C 16.1 from PRINTFLIKE_FUNCPTR(). In the course of preparing these changes notice that XL C uses the Clang block in diag-control.h (XL C mimics both Clang and GCC to some extent), although the behaviour is different between the two compilers. Add a new block for XL C there. In build_common.sh add more comments to explain XL C quirks and detect XL C for Linux too so it receives the right CFLAGS. Update CHANGES to mention this and earlier improvements.
* Suppress "casting away const" warnings in missing/getopt_long.c.Guy Harris2021-07-241-0/+12
| | | | | | | | | | | | | | | | | It's explicitly cheating in some places; just cast away the warnings. Add a Clang version testing macro to compiler-tests.h. Move the diagnostic control #defines from netdissect-stdinc.h to diag-control.h, libpcap-style, so that they can be used by code that doesn't use (or need) netdissect-stdinc.h. This also means that we can limit the inclusion of diag-control.h, and the definition of those Do them more libpcap-style, with separate DIAG_OFF/DIAG_ON pairs for particular issues, rather than having DIAG_OFF() and DIAG_ON() macros that take -W option names as arguments; that way, if we need to define them for compilers that don't have the GCC/Clang syntax for those pragmas, e.g. MSVC, we can do so.
* Use more HTTPS in URLsFrancois-Xavier Le Bail2019-08-191-1/+1
| | | | [skip ci]
* Don't test for __attribute__ in the configure script.Guy Harris2018-01-211-0/+151
Instead, use compiler test macros to check whether *particular* attributes are supported, and set various #defines appropriately, in header files. Rename the UNALIGNED structure attribute to ND_UNALIGNED, and ask whether we still need it.