systemd/0075-shared-drop-UNIQUE.patch
Zbigniew Jędrzejewski-Szmek 62fe9450da Update to latest git
2014-10-07 15:51:56 -04:00

42 lines
1.6 KiB
Diff

From 418bcb0ce3b704ea26ee1b4a68706abca536f65a Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Fri, 22 Aug 2014 14:38:28 +0200
Subject: [PATCH] shared: drop UNIQUE()
The UNIQUE() macro works fine if used in un-stacked macros. However, once
you stack them like:
MAX(MIN(a, b),
CLAMP(MAX(c, d), e, f))
you will get warnings due to shadowing other variables. gcc uses the last
line of a macro expansion as value for __LINE__, therefore, we cannot even
avoid this by splitting the expressions across lines.
Remove the only user of UNIQUE() so we introduce a new helper in
follow-ups.
---
src/shared/macro.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 43fa3e556f..2807bc74e8 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -79,8 +79,6 @@
#define XCONCATENATE(x, y) x ## y
#define CONCATENATE(x, y) XCONCATENATE(x, y)
-#define UNIQUE(prefix) CONCATENATE(prefix, __LINE__)
-
/* Rounds up */
#define ALIGN4(l) (((l) + 3) & ~3)
@@ -219,7 +217,7 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
#else
#define assert_cc(expr) \
DISABLE_WARNING_DECLARATION_AFTER_STATEMENT; \
- struct UNIQUE(_assert_struct_) { \
+ struct CONCATENATE(_assert_struct_, __LINE__) { \
char x[(expr) ? 0 : -1]; \
}; \
REENABLE_WARNING