Browse Source

GNU-style attributes: disable on z/OS as well like on windows; factor

IOSAD-230
Luca Saiu 6 months ago
parent
commit
0c763ea47f
3 changed files with 26 additions and 9 deletions
  1. +18
    -0
      src/platform_disable_attributes.h
  2. +4
    -9
      src/platform_windows.h
  3. +4
    -0
      src/platform_zos.h

+ 18
- 0
src/platform_disable_attributes.h View File

@ -0,0 +1,18 @@
#ifndef PLATFORM_DISABLE_ATTRIBUTES_H
#define PLATFORM_DISABLE_ATTRIBUTES_H
/* Disable GNU-style attributes
(https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html ), turning them
into noops. This lets the code compile with compilers not supporting
attributes, while keeping them enabled when they matter.
This header is included by platform-specific code where needed: it is not
for the user to directly see. */
/* Notice that this definition is extremely conservative: supporting exactly
one argument would suffice. */
#define __attribute__(...) /* nothing */
#define attribute __attribute__
#endif // #ifndef PLATFORM_DISABLE_ATTRIBUTES_H

+ 4
- 9
src/platform_windows.h View File

@ -9,20 +9,15 @@
// Windows platform specifica
// The windows compiler used by default does not support GNU-style attributes;
// let us just disable them altogether with a CPP defintition, so that
// attributes become no-ops on windows but keep functioning on the other
// platforms.
// Notice that this definition is extremely conservative: supporting exactly
// one argument would suffice.
#define __attribute__(...) /* nothing */
#define attribute __attribute__
#ifndef _EXPORT_PEP_ENGINE_DLL
#define _EXPORT_PEP_ENGINE_DLL
#endif
#pragma warning(disable : 4996)
// The compiler used by default on this platform does not support GNU-style
// attributes.
#include "platform_disable_attributes.h"
// We need to make sure winsock2 is included before windows.h, or we will get redefinitions of symbols
// as windows.h includes winsock1.h, so we will have duplicate symbols if windows.h is included first.
// It seems some of our code includes sync.h before including winsock.h, leading to the failure.


+ 4
- 0
src/platform_zos.h View File

@ -11,6 +11,10 @@
# error "this header should only ever be included on z/OS"
#endif
// The compiler used by default on this platform does not support GNU-style
// attributes.
#include "platform_disable_attributes.h"
/* Workaround standard header problems. */
#ifdef __cplusplus


Loading…
Cancel
Save