Skip to content

Commit 2bbd85a

Browse files
committed
flash/nor/stmsmi: fix compile error with clang 12.0.0
The git preliminarily version of clang 12.0.0_r370171 f067bc3c0ad6 reports an error in the expansion of the macro SMI_READ_REG(): error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro] Remove one intermediate macro expansion to make clang happy. Change-Id: I8ae6d9c18808467ba8044d70cbf0a4f76a18d3e6 Signed-off-by: Antonio Borneo <[email protected]> Reviewed-on: http://openocd.zylin.com/5958 Tested-by: jenkins Reviewed-by: Xiaofan <[email protected]>
1 parent 3938031 commit 2bbd85a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/flash/nor/stmsmi.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@
4141
#include <jtag/jtag.h>
4242
#include <helper/time_support.h>
4343

44-
#define SMI_READ_REG(a) (_SMI_READ_REG(a))
45-
#define _SMI_READ_REG(a) \
46-
{ \
44+
#define SMI_READ_REG(a) \
45+
({ \
4746
int _ret; \
4847
uint32_t _value; \
4948
\
5049
_ret = target_read_u32(target, io_base + (a), &_value); \
5150
if (_ret != ERROR_OK) \
5251
return _ret; \
5352
_value; \
54-
}
53+
})
5554

5655
#define SMI_WRITE_REG(a, v) \
5756
{ \

0 commit comments

Comments
 (0)