Browse Source

Wrapping '#define NULL' in #ifndef to avoid compiler warnings on plattforms that already have a definition for it.

ichrispa 8 years ago
parent
commit
002cecd5dc
1 changed files with 11 additions and 9 deletions
  1. 11 9
      tools/pyUANamespace/ua_namespace.py

+ 11 - 9
tools/pyUANamespace/ua_namespace.py

@@ -643,16 +643,18 @@ class opcua_namespace():
     header.append('#ifndef '+outfilename.upper()+'_H_')
     header.append('#ifndef '+outfilename.upper()+'_H_')
     header.append('#define '+outfilename.upper()+'_H_')
     header.append('#define '+outfilename.upper()+'_H_')
     header.append('#ifdef UA_NO_AMALGAMATION')
     header.append('#ifdef UA_NO_AMALGAMATION')
-    header.append('#include "server/ua_server_internal.h"')
-    header.append('#include "server/ua_nodes.h"')
-    header.append('#include "ua_util.h"')
-    header.append('#include "ua_types.h"')
-    header.append('#include "ua_types_encoding_binary.h"')
-    header.append('#include "ua_types_generated_encoding_binary.h"')
-    header.append('#include "ua_transport_generated_encoding_binary.h"')
+    header.append(  '#include "server/ua_server_internal.h"')
+    header.append(  '#include "server/ua_nodes.h"')
+    header.append('  #include "ua_util.h"')
+    header.append('  #include "ua_types.h"')
+    header.append('  #include "ua_types_encoding_binary.h"')
+    header.append('  #include "ua_types_generated_encoding_binary.h"')
+    header.append('  #include "ua_transport_generated_encoding_binary.h"')
     header.append('#else')
     header.append('#else')
-    header.append('#include "open62541.h"')
-    header.append('#define NULL ((void *)0)')
+    header.append('  #ifndef NULL')
+    header.append('    #define NULL ((void *)0)')
+    header.append('  #endif NULL')
+    header.append('  #include "open62541.h"')
     header.append('#endif')
     header.append('#endif')
     header.append('#ifndef UA_ENCODINGOFFSET_BINARY')
     header.append('#ifndef UA_ENCODINGOFFSET_BINARY')
     header.append('#define UA_ENCODINGOFFSET_BINARY 2')
     header.append('#define UA_ENCODINGOFFSET_BINARY 2')