Skip to contentSkip to conversation

Fix: Define __STDC_LIMIT_MACROS to fix C++ builds

PATCH New Mathieu Desnoyers 3 participants 5 messages Feb 8, 2014 – Feb 11, 2014 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

----- Original Message -----

Quoted 18 lines

From: "Jérémie Galarneau" <[email protected]>
To: [email protected]
Sent: Friday, February 7, 2014 6:32:21 PM
Subject: [lttng-dev] [PATCH lttng-tools] Fix: Define __STDC_LIMIT_MACROS to fix C++ builds

Necessary to include the fixed-width type limits on glibc versions older than 2.18 when building with a C++ compiler.

---
 include/lttng/lttng.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/lttng/lttng.h +0 -0
index 18dec2a..2d410fa 100644

include/lttng/lttng.h line 32

Quoted 10 lines
include/lttng/lttng.h +6 -0
@@ -23,7 +23,13 @@
 #define LTTNG_H
 
 #include <limits.h>
+/*
+ * Necessary to include the fixed width type limits on glibc versions older
+ * than 2.18 when building with a C++ compiler.
+ */
+#define __STDC_LIMIT_MACROS
 #include <stdint.h>
+#undef __STDC_LIMIT_MACROS

This has a side-effect: it undefines the __STDC_LIMIT_MACROS if it was defined prior to including this header. It should be:

#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#include <stdint.h>
#undef __STDC_LIMIT_MACROS
#else /* #ifndef __STDC_LIMIT_MACROS */
#include <stdint.h>
#endif /* #else #ifndef __STDC_LIMIT_MACROS */

Thanks,

Mathieu

Quoted 12 lines
include/lttng/lttng.h +0 -1
 #include <sys/types.h>
 
 /* Error codes that can be returned by API calls */
--

1.8.5.2

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 8 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 21 lines · Mathieu Desnoyers

----- Original Message -----

Quoted 20 lines

From: "Jérémie Galarneau" <[email protected]>
To: [email protected]
Sent: Friday, February 7, 2014 6:32:21 PM
Subject: [lttng-dev] [PATCH lttng-tools] Fix: Define __STDC_LIMIT_MACROS to fix C++ builds

Necessary to include the fixed-width type limits on glibc versions older than 2.18 when building with a C++ compiler.

---
 include/lttng/lttng.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/lttng/lttng.h +0 -0
index 18dec2a..2d410fa 100644
@@ -23,7 +23,13 @@
 #define LTTNG_H
 
Quoted 11 lines

include/lttng/lttng.h line 32

Quoted 8 lines
include/lttng/lttng.h +6 -0
 #include <limits.h>
+/*
+ * Necessary to include the fixed width type limits on glibc versions older
+ * than 2.18 when building with a C++ compiler.
+ */
+#define __STDC_LIMIT_MACROS
 #include <stdint.h>
+#undef __STDC_LIMIT_MACROS

This has a side-effect: it undefines the __STDC_LIMIT_MACROS if it was defined prior to including this header. It should be:

Good point! Resubmitting as v2.

Regards,
Jérémie

Quoted 30 lines

#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#include <stdint.h>
#undef __STDC_LIMIT_MACROS
#else /* #ifndef __STDC_LIMIT_MACROS */
#include <stdint.h>
#endif /* #else #ifndef __STDC_LIMIT_MACROS */

Thanks,

Mathieu

Quoted 7 lines
include/lttng/lttng.h +0 -1
 #include <sys/types.h>
 
 /* Error codes that can be returned by API calls */
--

1.8.5.2

Quoted 5 lines

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Signature · 3 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
#4 lore raw

PATCH v2 1/1 Fix: Define __STDC_LIMIT_MACROS to fix C++ builds

In reply to a message not in the archive

Necessary to include the fixed-width type limits on glibc versions older than 2.18 when building with a C++ compiler.

---
 include/lttng/lttng.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/lttng/lttng.h +10 -0
index 18dec2a..f0be224 100644
@@ -23,7 +23,17 @@
 #define LTTNG_H
 
 #include <limits.h>
+/*
+ * Necessary to include the fixed width type limits on glibc versions older
+ * than 2.18 when building with a C++ compiler.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#include <stdint.h>
+#undef __STDC_LIMIT_MACROS
+#else /* #ifndef __STDC_LIMIT_MACROS */
 #include <stdint.h>
+#endif /* #else #ifndef __STDC_LIMIT_MACROS */
 #include <sys/types.h>
 
 /* Error codes that can be returned by API calls */
Signature · 7 lines
1.8.5.4


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

author Acked-by
#6 lore raw

----- Original Message -----

Quoted 44 lines

From: "Jérémie Galarneau" <[email protected]>
To: [email protected]
Sent: Monday, February 10, 2014 11:04:22 AM
Subject: [lttng-dev] [PATCH lttng-tools v2] Fix: Define __STDC_LIMIT_MACROS to fix C++ builds

Necessary to include the fixed-width type limits on glibc versions older than 2.18 when building with a C++ compiler.

---
 include/lttng/lttng.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/lttng/lttng.h +10 -1
index 18dec2a..f0be224 100644
@@ -23,7 +23,17 @@
 #define LTTNG_H
 
 #include <limits.h>
+/*
+ * Necessary to include the fixed width type limits on glibc versions older
+ * than 2.18 when building with a C++ compiler.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#include <stdint.h>
+#undef __STDC_LIMIT_MACROS
+#else /* #ifndef __STDC_LIMIT_MACROS */
 #include <stdint.h>
+#endif /* #else #ifndef __STDC_LIMIT_MACROS */
 #include <sys/types.h>
 
 /* Error codes that can be returned by API calls */
--

1.8.5.4

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 8 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#7 lore raw
In reply to a message not in the archive

Merged!

Backported to stable-2.4 and 2.3

Quoted 38 lines · Jérémie Galarneau

Necessary to include the fixed-width type limits on glibc versions older than 2.18 when building with a C++ compiler.

---
 include/lttng/lttng.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/lttng/lttng.h +10 -0
index 18dec2a..f0be224 100644
@@ -23,7 +23,17 @@
 #define LTTNG_H
 
 #include <limits.h>
+/*
+ * Necessary to include the fixed width type limits on glibc versions older
+ * than 2.18 when building with a C++ compiler.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#include <stdint.h>
+#undef __STDC_LIMIT_MACROS
+#else /* #ifndef __STDC_LIMIT_MACROS */
 #include <stdint.h>
+#endif /* #else #ifndef __STDC_LIMIT_MACROS */
 #include <sys/types.h>
 
 /* Error codes that can be returned by API calls */
Signature · 7 lines
1.8.5.4


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev