aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPhil Carmody <ext-phil.2.carmody@nokia.com>2011-07-14 08:07:13 -0400
committerJiri Kosina <jkosina@suse.cz>2011-07-21 08:10:00 -0400
commit497888cf69bf607ac1fe061a6437e0a670b0022f (patch)
treeac0897eff214f09c89d5f4fbc3c03ef9d010a83c /arch
parent06b72d06d6b182bdaaaec686dbd8b602949521ee (diff)
treewide: fix potentially dangerous trailing ';' in #defined values/expressions
All these are instances of #define NAME value; or #define NAME(params_opt) value; These of course fail to build when used in contexts like if(foo $OP NAME) while(bar $OP NAME) and may silently generate the wrong code in contexts such as foo = NAME + 1; /* foo = value; + 1; */ bar = NAME - 1; /* bar = value; - 1; */ baz = NAME & quux; /* baz = value; & quux; */ Reported on comp.lang.c, Message-ID: <ab0d55fe-25e5-482b-811e-c475aa6065c3@c29g2000yqd.googlegroups.com> Initial analysis of the dangers provided by Keith Thompson in that thread. There are many more instances of more complicated macros having unnecessary trailing semicolons, but this pile seems to be all of the cases of simple values suffering from the problem. (Thus things that are likely to be found in one of the contexts above, more complicated ones aren't.) Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/floppy.h2
-rw-r--r--arch/h8300/kernel/setup.c2
-rw-r--r--arch/ia64/include/asm/sn/tioce.h2
-rw-r--r--arch/mips/include/asm/floppy.h2
-rw-r--r--arch/parisc/include/asm/dma-mapping.h2
-rw-r--r--arch/parisc/math-emu/decode_exc.c2
-rw-r--r--arch/powerpc/include/asm/elf.h4
-rw-r--r--arch/powerpc/include/asm/smu.h2
-rw-r--r--arch/sparc/include/asm/elf_64.h2
-rw-r--r--arch/um/sys-i386/signal.c2
-rw-r--r--arch/x86/kernel/i387.c2
11 files changed, 12 insertions, 12 deletions
diff --git a/arch/alpha/include/asm/floppy.h b/arch/alpha/include/asm/floppy.h
index 0be50413b2b5..46cefbd50e73 100644
--- a/arch/alpha/include/asm/floppy.h
+++ b/arch/alpha/include/asm/floppy.h
@@ -27,7 +27,7 @@
27#define fd_cacheflush(addr,size) /* nothing */ 27#define fd_cacheflush(addr,size) /* nothing */
28#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\ 28#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\
29 IRQF_DISABLED, "floppy", NULL) 29 IRQF_DISABLED, "floppy", NULL)
30#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); 30#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL)
31 31
32#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
33 33
diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c
index 7fda657110eb..68d651081bd3 100644
--- a/arch/h8300/kernel/setup.c
+++ b/arch/h8300/kernel/setup.c
@@ -46,7 +46,7 @@
46#include <asm/regs267x.h> 46#include <asm/regs267x.h>
47#endif 47#endif
48 48
49#define STUBSIZE 0xc000; 49#define STUBSIZE 0xc000
50 50
51unsigned long rom_length; 51unsigned long rom_length;
52unsigned long memory_start; 52unsigned long memory_start;
diff --git a/arch/ia64/include/asm/sn/tioce.h b/arch/ia64/include/asm/sn/tioce.h
index 893468e1b41b..6eae8ada90f0 100644
--- a/arch/ia64/include/asm/sn/tioce.h
+++ b/arch/ia64/include/asm/sn/tioce.h
@@ -467,7 +467,7 @@ typedef volatile struct tioce {
467#define CE_LSI_GB_CFG1_RXL0S_THS_SHFT 0 467#define CE_LSI_GB_CFG1_RXL0S_THS_SHFT 0
468#define CE_LSI_GB_CFG1_RXL0S_THS_MASK (0xffULL << 0) 468#define CE_LSI_GB_CFG1_RXL0S_THS_MASK (0xffULL << 0)
469#define CE_LSI_GB_CFG1_RXL0S_SMP_SHFT 8 469#define CE_LSI_GB_CFG1_RXL0S_SMP_SHFT 8
470#define CE_LSI_GB_CFG1_RXL0S_SMP_MASK (0xfULL << 8); 470#define CE_LSI_GB_CFG1_RXL0S_SMP_MASK (0xfULL << 8)
471#define CE_LSI_GB_CFG1_RXL0S_ADJ_SHFT 12 471#define CE_LSI_GB_CFG1_RXL0S_ADJ_SHFT 12
472#define CE_LSI_GB_CFG1_RXL0S_ADJ_MASK (0x7ULL << 12) 472#define CE_LSI_GB_CFG1_RXL0S_ADJ_MASK (0x7ULL << 12)
473#define CE_LSI_GB_CFG1_RXL0S_FLT_SHFT 15 473#define CE_LSI_GB_CFG1_RXL0S_FLT_SHFT 15
diff --git a/arch/mips/include/asm/floppy.h b/arch/mips/include/asm/floppy.h
index c5c7c0e6064c..4456c9c47e21 100644
--- a/arch/mips/include/asm/floppy.h
+++ b/arch/mips/include/asm/floppy.h
@@ -29,7 +29,7 @@ static inline void fd_cacheflush(char * addr, long size)
29#define FLOPPY0_TYPE fd_drive_type(0) 29#define FLOPPY0_TYPE fd_drive_type(0)
30#define FLOPPY1_TYPE fd_drive_type(1) 30#define FLOPPY1_TYPE fd_drive_type(1)
31 31
32#define FDC1 fd_getfdaddr1(); 32#define FDC1 fd_getfdaddr1()
33 33
34#define N_FDC 1 /* do you *really* want a second controller? */ 34#define N_FDC 1 /* do you *really* want a second controller? */
35#define N_DRIVE 8 35#define N_DRIVE 8
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 4ef73b09b168..890531e32fe8 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -210,7 +210,7 @@ parisc_walk_tree(struct device *dev)
210 return dev->platform_data; 210 return dev->platform_data;
211} 211}
212 212
213#define GET_IOC(dev) (HBA_DATA(parisc_walk_tree(dev))->iommu); 213#define GET_IOC(dev) (HBA_DATA(parisc_walk_tree(dev))->iommu)
214 214
215 215
216#ifdef CONFIG_IOMMU_CCIO 216#ifdef CONFIG_IOMMU_CCIO
diff --git a/arch/parisc/math-emu/decode_exc.c b/arch/parisc/math-emu/decode_exc.c
index 27a7492ddb0d..04e550e76ae8 100644
--- a/arch/parisc/math-emu/decode_exc.c
+++ b/arch/parisc/math-emu/decode_exc.c
@@ -56,7 +56,7 @@
56/* General definitions */ 56/* General definitions */
57#define DOESTRAP 1 57#define DOESTRAP 1
58#define NOTRAP 0 58#define NOTRAP 0
59#define SIGNALCODE(signal, code) ((signal) << 24 | (code)); 59#define SIGNALCODE(signal, code) ((signal) << 24 | (code))
60#define copropbit 1<<31-2 /* bit position 2 */ 60#define copropbit 1<<31-2 /* bit position 2 */
61#define opclass 9 /* bits 21 & 22 */ 61#define opclass 9 /* bits 21 & 22 */
62#define fmt 11 /* bits 19 & 20 */ 62#define fmt 11 /* bits 19 & 20 */
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 2b917c69ed15..3bf9cca35147 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -267,7 +267,7 @@ extern int ucache_bsize;
267struct linux_binprm; 267struct linux_binprm;
268extern int arch_setup_additional_pages(struct linux_binprm *bprm, 268extern int arch_setup_additional_pages(struct linux_binprm *bprm,
269 int uses_interp); 269 int uses_interp);
270#define VDSO_AUX_ENT(a,b) NEW_AUX_ENT(a,b); 270#define VDSO_AUX_ENT(a,b) NEW_AUX_ENT(a,b)
271 271
272/* 1GB for 64bit, 8MB for 32bit */ 272/* 1GB for 64bit, 8MB for 32bit */
273#define STACK_RND_MASK (is_32bit_task() ? \ 273#define STACK_RND_MASK (is_32bit_task() ? \
@@ -298,7 +298,7 @@ do { \
298 NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize); \ 298 NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize); \
299 NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize); \ 299 NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize); \
300 NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize); \ 300 NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize); \
301 VDSO_AUX_ENT(AT_SYSINFO_EHDR, current->mm->context.vdso_base) \ 301 VDSO_AUX_ENT(AT_SYSINFO_EHDR, current->mm->context.vdso_base); \
302} while (0) 302} while (0)
303 303
304/* PowerPC64 relocations defined by the ABIs */ 304/* PowerPC64 relocations defined by the ABIs */
diff --git a/arch/powerpc/include/asm/smu.h b/arch/powerpc/include/asm/smu.h
index e3bdada8c542..ae20ce1af4c7 100644
--- a/arch/powerpc/include/asm/smu.h
+++ b/arch/powerpc/include/asm/smu.h
@@ -547,7 +547,7 @@ struct smu_sdbp_header {
547 * (currently, afaik, this concerns only the FVT partition 547 * (currently, afaik, this concerns only the FVT partition
548 * (0x12) 548 * (0x12)
549 */ 549 */
550#define SMU_U16_MIX(x) le16_to_cpu(x); 550#define SMU_U16_MIX(x) le16_to_cpu(x)
551#define SMU_U32_MIX(x) ((((x) & 0xff00ff00u) >> 8)|(((x) & 0x00ff00ffu) << 8)) 551#define SMU_U32_MIX(x) ((((x) & 0xff00ff00u) >> 8)|(((x) & 0x00ff00ffu) << 8))
552 552
553 553
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index e67880381b84..cfa9cd2e5519 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -186,7 +186,7 @@ static inline unsigned int sparc64_elf_hwcap(void)
186 return cap; 186 return cap;
187} 187}
188 188
189#define ELF_HWCAP sparc64_elf_hwcap(); 189#define ELF_HWCAP sparc64_elf_hwcap()
190 190
191/* This yields a string that ld.so will use to load implementation 191/* This yields a string that ld.so will use to load implementation
192 specific libraries for optimization. This is more specific in 192 specific libraries for optimization. This is more specific in
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 129647375a6c..89a46626bfd8 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -58,7 +58,7 @@ static inline unsigned long twd_fxsr_to_i387(struct user_fxsr_struct *fxsave)
58 unsigned long ret = 0xffff0000; 58 unsigned long ret = 0xffff0000;
59 int i; 59 int i;
60 60
61#define FPREG_ADDR(f, n) ((char *)&(f)->st_space + (n) * 16); 61#define FPREG_ADDR(f, n) ((char *)&(f)->st_space + (n) * 16)
62 62
63 for (i = 0; i < 8; i++) { 63 for (i = 0; i < 8; i++) {
64 if (twd & 0x1) { 64 if (twd & 0x1) {
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 12aff2537682..739d8598f789 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -321,7 +321,7 @@ static inline unsigned short twd_i387_to_fxsr(unsigned short twd)
321 return tmp; 321 return tmp;
322} 322}
323 323
324#define FPREG_ADDR(f, n) ((void *)&(f)->st_space + (n) * 16); 324#define FPREG_ADDR(f, n) ((void *)&(f)->st_space + (n) * 16)
325#define FP_EXP_TAG_VALID 0 325#define FP_EXP_TAG_VALID 0
326#define FP_EXP_TAG_ZERO 1 326#define FP_EXP_TAG_ZERO 1
327#define FP_EXP_TAG_SPECIAL 2 327#define FP_EXP_TAG_SPECIAL 2