소스 검색

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

ichrispa 8 년 전
부모
커밋
002cecd5dc
1개의 변경된 파일11개의 추가작업 그리고 9개의 파일을 삭제
  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('#define '+outfilename.upper()+'_H_')
     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('#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('#ifndef UA_ENCODINGOFFSET_BINARY')
     header.append('#define UA_ENCODINGOFFSET_BINARY 2')