Quellcode durchsuchen

Stack: Correctly handle queue.h redefinitions

Stefan Profanter vor 6 Jahren
Ursprung
Commit
358315747d

+ 0 - 28
arch/eCos/ua_architecture.h

@@ -84,34 +84,6 @@ int gethostname_ecos(char* name, size_t len);
 
 #include "../ua_architecture_functions.h"
 
-#undef SLIST_EMPTY
-#undef SLIST_FOREACH
-#undef SLIST_INIT
-#undef SLIST_REMOVE
-
-#undef LIST_EMPTY
-#undef LIST_FOREACH
-#undef LIST_INIT
-#undef LIST_REMOVE
-
-#undef TAILQ_EMPTY
-#undef TAILQ_FOREACH
-#undef TAILQ_INIT
-#undef TAILQ_REMOVE
-#undef TAILQ_FOREACH_REVERSE
-
-#undef CIRCLEQ_EMPTY
-#undef CIRCLEQ_FOREACH
-#undef CIRCLEQ_INIT
-#undef CIRCLEQ_FOREACH_REVERSE
-#undef CIRCLEQ_REMOVE
-#undef CIRCLEQ_INSERT_TAIL
-#undef CIRCLEQ_INSERT_HEAD
-#undef CIRCLEQ_INSERT_AFTER
-#undef CIRCLEQ_INSERT_BEFORE
-
-#undef _SYS_QUEUE_H_
-
 #endif /* PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_ */
 
 #endif /* UA_ARCHITECTURE_ECOS */

+ 89 - 8
arch/posix/ua_architecture.h

@@ -136,34 +136,115 @@
 
 #include "../ua_architecture_functions.h"
 
+#if defined(__APPLE__)  && defined(_SYS_QUEUE_H_)
+//  in some compilers there's already a _SYS_QUEUE_H_ which is included first and doesn't have all functions
+
+#undef SLIST_HEAD
+#undef SLIST_HEAD_INITIALIZER
+#undef SLIST_ENTRY
+#undef SLIST_FIRST
+#undef SLIST_END
 #undef SLIST_EMPTY
+#undef SLIST_NEXT
 #undef SLIST_FOREACH
+#undef SLIST_FOREACH_SAFE
 #undef SLIST_INIT
+#undef SLIST_INSERT_AFTER
+#undef SLIST_INSERT_HEAD
+#undef SLIST_REMOVE_AFTER
+#undef SLIST_REMOVE_HEAD
 #undef SLIST_REMOVE
-
+#undef LIST_HEAD
+#undef LIST_HEAD_INITIALIZER
+#undef LIST_ENTRY
+#undef LIST_FIRST
+#undef LIST_END
 #undef LIST_EMPTY
+#undef LIST_NEXT
 #undef LIST_FOREACH
+#undef LIST_FOREACH_SAFE
 #undef LIST_INIT
+#undef LIST_INSERT_AFTER
+#undef LIST_INSERT_BEFORE
+#undef LIST_INSERT_HEAD
 #undef LIST_REMOVE
-
+#undef LIST_REPLACE
+#undef SIMPLEQ_HEAD
+#undef SIMPLEQ_HEAD_INITIALIZER
+#undef SIMPLEQ_ENTRY
+#undef SIMPLEQ_FIRST
+#undef SIMPLEQ_END
+#undef SIMPLEQ_EMPTY
+#undef SIMPLEQ_NEXT
+#undef SIMPLEQ_FOREACH
+#undef SIMPLEQ_FOREACH_SAFE
+#undef SIMPLEQ_INIT
+#undef SIMPLEQ_INSERT_HEAD
+#undef SIMPLEQ_INSERT_TAIL
+#undef SIMPLEQ_INSERT_AFTER
+#undef SIMPLEQ_REMOVE_HEAD
+#undef SIMPLEQ_REMOVE_AFTER
+#undef XSIMPLEQ_HEAD
+#undef XSIMPLEQ_ENTRY
+#undef XSIMPLEQ_XOR
+#undef XSIMPLEQ_FIRST
+#undef XSIMPLEQ_END
+#undef XSIMPLEQ_EMPTY
+#undef XSIMPLEQ_NEXT
+#undef XSIMPLEQ_FOREACH
+#undef XSIMPLEQ_FOREACH_SAFE
+#undef XSIMPLEQ_INIT
+#undef XSIMPLEQ_INSERT_HEAD
+#undef XSIMPLEQ_INSERT_TAIL
+#undef XSIMPLEQ_INSERT_AFTER
+#undef XSIMPLEQ_REMOVE_HEAD
+#undef XSIMPLEQ_REMOVE_AFTER
+#undef TAILQ_HEAD
+#undef TAILQ_HEAD_INITIALIZER
+#undef TAILQ_ENTRY
+#undef TAILQ_FIRST
+#undef TAILQ_END
+#undef TAILQ_NEXT
+#undef TAILQ_LAST
+#undef TAILQ_PREV
 #undef TAILQ_EMPTY
 #undef TAILQ_FOREACH
+#undef TAILQ_FOREACH_SAFE
+#undef TAILQ_FOREACH_REVERSE
+#undef TAILQ_FOREACH_REVERSE_SAFE
 #undef TAILQ_INIT
+#undef TAILQ_INSERT_HEAD
+#undef TAILQ_INSERT_TAIL
+#undef TAILQ_INSERT_AFTER
+#undef TAILQ_INSERT_BEFORE
 #undef TAILQ_REMOVE
-#undef TAILQ_FOREACH_REVERSE
-
+#undef TAILQ_REPLACE
+#undef CIRCLEQ_HEAD
+#undef CIRCLEQ_HEAD_INITIALIZER
+#undef CIRCLEQ_ENTRY
+#undef CIRCLEQ_FIRST
+#undef CIRCLEQ_LAST
+#undef CIRCLEQ_END
+#undef CIRCLEQ_NEXT
+#undef CIRCLEQ_PREV
 #undef CIRCLEQ_EMPTY
 #undef CIRCLEQ_FOREACH
-#undef CIRCLEQ_INIT
+#undef CIRCLEQ_FOREACH_SAFE
 #undef CIRCLEQ_FOREACH_REVERSE
-#undef CIRCLEQ_REMOVE
-#undef CIRCLEQ_INSERT_TAIL
-#undef CIRCLEQ_INSERT_HEAD
+#undef CIRCLEQ_FOREACH_REVERSE_SAFE
+#undef CIRCLEQ_INIT
 #undef CIRCLEQ_INSERT_AFTER
 #undef CIRCLEQ_INSERT_BEFORE
+#undef CIRCLEQ_INSERT_HEAD
+#undef CIRCLEQ_INSERT_TAIL
+#undef CIRCLEQ_REMOVE
+#undef CIRCLEQ_REPLACE
 
 #undef _SYS_QUEUE_H_
 
+#endif /* defined(__APPLE__)  && defined(_SYS_QUEUE_H_) */
+
+
 #endif /* PLUGINS_ARCH_POSIX_UA_ARCHITECTURE_H_ */
 
 #endif /* UA_ARCHITECTURE_POSIX */

+ 0 - 41
arch/vxworks/ua_architecture.h

@@ -109,47 +109,6 @@
 
 #include "../ua_architecture_functions.h"
 
-#undef SLIST_EMPTY
-#undef SLIST_FOREACH
-#undef SLIST_INIT
-#undef SLIST_REMOVE
-
-#undef LIST_EMPTY
-#undef LIST_FOREACH
-#undef LIST_INIT
-#undef LIST_REMOVE
-
-#undef TAILQ_EMPTY
-#undef TAILQ_FOREACH
-#undef TAILQ_INIT
-#undef TAILQ_REMOVE
-#undef TAILQ_FOREACH_REVERSE
-
-#undef CIRCLEQ_EMPTY
-#undef CIRCLEQ_FOREACH
-#undef CIRCLEQ_INIT
-#undef CIRCLEQ_FOREACH_REVERSE
-#undef CIRCLEQ_REMOVE
-#undef CIRCLEQ_INSERT_TAIL
-#undef CIRCLEQ_INSERT_HEAD
-#undef CIRCLEQ_INSERT_AFTER
-#undef CIRCLEQ_INSERT_BEFORE
-
-#undef SLIST_INSERT_AFTER
-#undef SLIST_INSERT_HEAD
-#undef SLIST_REMOVE_HEAD
-#undef LIST_INSERT_AFTER
-#undef LIST_INSERT_BEFORE
-#undef LIST_INSERT_HEAD
-#undef TAILQ_INSERT_HEAD
-#undef TAILQ_INSERT_TAIL
-#undef TAILQ_INSERT_AFTER
-#undef TAILQ_INSERT_BEFORE
-#undef CIRCLEQ_HEAD_INITIALIZER
-
-
-#undef _SYS_QUEUE_H_
-
 #endif /* PLUGINS_ARCH_VXWORKS_UA_ARCHITECTURE_H_ */
 
 #endif /* UA_ARCHITECTURE_VXWORKS */

+ 1 - 1
arch/wec7/ua_architecture.h

@@ -139,7 +139,7 @@ char *strerror(int errnum);
 #include "../ua_architecture_functions.h"
 
 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
-#ifdef SLIST_ENTRY
+#if !defined(_SYS_QUEUE_H_) && defined(SLIST_ENTRY)
 # undef SLIST_ENTRY
 #endif
 

+ 1 - 1
arch/win32/ua_architecture.h

@@ -145,7 +145,7 @@
 #include "../ua_architecture_functions.h"
 
 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
-#ifdef SLIST_ENTRY
+#if !defined(_SYS_QUEUE_H_) && defined(SLIST_ENTRY)
 # undef SLIST_ENTRY
 #endif