Update preprocessor macros useful for clang
authorLudwig Jäck <ludwig.jaeck@intra2net.com>
Fri, 31 May 2024 09:55:12 +0000 (11:55 +0200)
committerLudwig Jäck <ludwig.jaeck@intra2net.com>
Fri, 7 Jun 2024 08:02:01 +0000 (10:02 +0200)
Clang does not support the 'gccxml' attribute.
User defined string attributes need to use the 'annotate' attribute.
See Github issue: https://github.com/CastXML/CastXML/issues/25

codegen/codegen-stubhead.hxx

index d55f323..3009da1 100644 (file)
@@ -30,7 +30,7 @@ on this file might be covered by the GNU General Public License.
 #include <t2n_exception.hxx>
 #include <command.hxx>
 
-#ifdef __GCCXML__
+#ifdef __castxml__
 // used during parsing run with gccxml
 
 /** @brief mark a function to export it via libt2n
@@ -42,7 +42,7 @@ on this file might be covered by the GNU General Public License.
     }
     @endcode
 */
-#define LIBT2N_EXPORT __attribute((gccxml("libt2n-default")))
+#define LIBT2N_EXPORT __attribute__((annotate("libt2n-default")))
 
 
 /** @brief tell libt2n about a default argument
@@ -58,11 +58,10 @@ on this file might be covered by the GNU General Public License.
     @remarks Codegen gets default arguments via this define (gccxml-attribute) because gccxml
              does not correctly output them (e.g. the namespace is ambiguous)
 */
-#define LIBT2N_DEFAULT_ARG(type,value) __attribute((gccxml("libt2n-default-arg",#value))) type = value
+#define LIBT2N_DEFAULT_ARG(type,value) __attribute__((annotate("libt2n-default-arg,"#value))) type = value
 
 #else
 // used during regular compile
-
 #define LIBT2N_EXPORT
 #define LIBT2N_DEFAULT_ARG(type,value) type = value