Skip to contentSkip to conversation

libxl: fix build for gcc prior to 4.3

PATCH In review Jan Beulich 2 participants 5 messages Aug 8, 2012 – Aug 14, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: fix build for gcc prior to 4.3

So far all we (explicitly) require is gcc 3.4 or better, so we shouldn't be unconditionally using features supported only by much newer versions.

Short of a proper replacement, use the "deprecated" attribute instead:
It also produces a warning (thus causing the build to fail due to -Werror), and is at least getting close to the intention here.

tools/libxl/libxl_internal.h +5 -1
@@ -55,8 +55,12 @@
 #ifdef LIBXL_H
 # error libxl.h should be included via libxl_internal.h, not separately
 #endif
-#define LIBXL_EXTERNAL_CALLERS_ONLY \
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+# define LIBXL_EXTERNAL_CALLERS_ONLY \
     __attribute__((warning("may not be called from within libxl")))
+#else
+# define LIBXL_EXTERNAL_CALLERS_ONLY __attribute__((__deprecated__))
+#endif
 
 #include "libxl.h"
 #include "_paths.h"

libxl: fix build for gcc prior to 4.3

So far all we (explicitly) require is gcc 3.4 or better, so we shouldn't be unconditionally using features supported only by much newer versions.

Short of a proper replacement, use the "deprecated" attribute instead:
It also produces a warning (thus causing the build to fail due to -Werror), and is at least getting close to the intention here.

tools/libxl/libxl_internal.h +5 -1
@@ -55,8 +55,12 @@
 #ifdef LIBXL_H
 # error libxl.h should be included via libxl_internal.h, not separately
 #endif
-#define LIBXL_EXTERNAL_CALLERS_ONLY \
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+# define LIBXL_EXTERNAL_CALLERS_ONLY \
     __attribute__((warning("may not be called from within libxl")))
+#else
+# define LIBXL_EXTERNAL_CALLERS_ONLY __attribute__((__deprecated__))
+#endif
 
 #include "libxl.h"
 #include "_paths.h"

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw

Jan Beulich writes ("[Xen-devel] [PATCH] libxl: fix build for gcc prior to 4.3"):

Quoted 3 lines

So far all we (explicitly) require is gcc 3.4 or better, so we shouldn't be unconditionally using features supported only by much newer versions.

Sorry about that.

Quoted 3 lines

Short of a proper replacement, use the "deprecated" attribute instead:
It also produces a warning (thus causing the build to fail due to -Werror), and is at least getting close to the intention here.

I think it would be fine to simply drop this check for earlier gcc's. That would make the compatibility ifdeffery simpler so I would prefer that.

Thanks,
Ian.

#2 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Ian Jackson

Jan Beulich writes ("[Xen-devel] [PATCH] libxl: fix build for gcc prior to

Quoted 3 lines

Short of a proper replacement, use the "deprecated" attribute instead:
It also produces a warning (thus causing the build to fail due to -Werror), and is at least getting close to the intention here.

I think it would be fine to simply drop this check for earlier gcc's. That would make the compatibility ifdeffery simpler so I would prefer that.

While I think the other version was reasonable, here you go.

Jan

libxl: fix build for gcc prior to 4.3

So far all we (explicitly) require is gcc 3.4 or better, so we shouldn't be unconditionally using features supported only by much newer versions.

Short of a proper replacement, use the "deprecated" attribute instead:
It also produces a warning (thus causing the build to fail due to -Werror), and is at least getting close to the intention here.

tools/libxl/libxl_internal.h +3 -1
@@ -55,8 +55,10 @@
 #ifdef LIBXL_H
 # error libxl.h should be included via libxl_internal.h, not separately
 #endif
-#define LIBXL_EXTERNAL_CALLERS_ONLY \
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+# define LIBXL_EXTERNAL_CALLERS_ONLY \
     __attribute__((warning("may not be called from within libxl")))
+#endif
 
 #include "libxl.h"
 #include "_paths.h"
#4 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Ian Jackson

Jan Beulich writes ("Re: [Xen-devel] [PATCH] libxl: fix build for gcc prior to 4.3"):

Quoted 1 line

While I think the other version was reasonable, here you go.

Quoted 7 lines

Thanks,

I removed the now-redundant paragraph about ((deprecated)) from the commit message.

Oh, thanks and sorry.

Jan