Win: Can now use "static inline" on Windows (i.e. no code mods).
diff --git a/include/xglIcd.h b/include/xglIcd.h
index 3efffe6..1c25936 100644
--- a/include/xglIcd.h
+++ b/include/xglIcd.h
@@ -18,12 +18,12 @@
void *loaderData;
} XGL_LOADER_DATA;
-STATIC_INLINE void set_loader_magic_value(void *pNewObject) {
+static inline void set_loader_magic_value(void *pNewObject) {
XGL_LOADER_DATA *loader_info = (XGL_LOADER_DATA *) pNewObject;
loader_info->loaderMagic = ICD_LOADER_MAGIC;
}
-STATIC_INLINE bool valid_loader_magic_value(void *pNewObject) {
+static inline bool valid_loader_magic_value(void *pNewObject) {
const XGL_LOADER_DATA *loader_info = (XGL_LOADER_DATA *) pNewObject;
return loader_info->loaderMagic == ICD_LOADER_MAGIC;
}
diff --git a/include/xglPlatform.h b/include/xglPlatform.h
index af006a2..aff2e5b 100644
--- a/include/xglPlatform.h
+++ b/include/xglPlatform.h
@@ -44,13 +44,13 @@
#define XGLAPI __stdcall
// C99:
- #define STATIC_INLINE static
+#ifndef __cplusplus
+ #undef inline
+ #define inline __inline
+#endif // __cplusplus
#elif defined(__GNUC__)
// On other platforms using GCC, XGLAPI stays undefined
#define XGLAPI
-
- // C99:
- #define STATIC_INLINE static inline
#else
// Unsupported Platform!
#error "Unsupported OS Platform detected!"
diff --git a/xgl-generate.py b/xgl-generate.py
index 202b30f..9164cda 100755
--- a/xgl-generate.py
+++ b/xgl-generate.py
@@ -275,7 +275,7 @@
stmts.append("#endif")
func = []
- func.append("STATIC_INLINE void %s_initialize_dispatch_table(XGL_LAYER_DISPATCH_TABLE *table,"
+ func.append("static inline void %s_initialize_dispatch_table(XGL_LAYER_DISPATCH_TABLE *table,"
% self.prefix)
func.append("%s xglGetProcAddrType gpa,"
% (" " * len(self.prefix)))
@@ -298,7 +298,7 @@
lookups.append("#endif")
func = []
- func.append("STATIC_INLINE void *%s_lookup_dispatch_table(const XGL_LAYER_DISPATCH_TABLE *table,"
+ func.append("static inline void *%s_lookup_dispatch_table(const XGL_LAYER_DISPATCH_TABLE *table,"
% self.prefix)
func.append("%s const char *name)"
% (" " * len(self.prefix)))
@@ -419,7 +419,7 @@
lookups.append("#endif")
body = []
- body.append("STATIC_INLINE %s layer_intercept_proc(const char *name)" %
+ body.append("static inline %s layer_intercept_proc(const char *name)" %
self.gpa.ret)
body.append("{")
body.append(generate_get_proc_addr_check("name"))
diff --git a/xgl_helper.py b/xgl_helper.py
index 630a6c4..19dbc43 100755
--- a/xgl_helper.py
+++ b/xgl_helper.py
@@ -1015,7 +1015,7 @@
body = []
for bet in self.et_dict:
fet = self.tf_dict[bet]
- body.append("STATIC_INLINE uint32_t validate_%s(%s input_value)\n{\n switch ((%s)input_value)\n {" % (fet, fet, fet))
+ body.append("static inline uint32_t validate_%s(%s input_value)\n{\n switch ((%s)input_value)\n {" % (fet, fet, fet))
for e in sorted(self.et_dict[bet]):
if (self.ev_dict[e]['unique']):
body.append(' case %s:' % (e))
@@ -1028,7 +1028,7 @@
# bet == base_enum_type, fet == final_enum_type
for bet in self.et_dict:
fet = self.tf_dict[bet]
- body.append("STATIC_INLINE const char* string_%s(%s input_value)\n{\n switch ((%s)input_value)\n {" % (fet, fet, fet))
+ body.append("static inline const char* string_%s(%s input_value)\n{\n switch ((%s)input_value)\n {" % (fet, fet, fet))
for e in sorted(self.et_dict[bet]):
if (self.ev_dict[e]['unique']):
body.append(' case %s:\n return "%s";' % (e, e))
@@ -1038,12 +1038,7 @@
def _generateSHHeader(self):
header = []
header.append('#pragma once\n')
- header.append('#include <%s>\n' % self.in_file)
- header.append('#if defined(_WIN32)')
- header.append('#define STATIC_INLINE static')
- header.append('#else // defined(_WIN32)')
- header.append('#define STATIC_INLINE static inline')
- header.append('#endif // defined(_WIN32)\n\n\n')
+ header.append('#include <%s>\n\n\n' % self.in_file)
return "\n".join(header)