diff options
author | Phil Carmody <ext-phil.2.carmody@nokia.com> | 2011-07-14 08:07:13 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-07-21 08:10:00 -0400 |
commit | 497888cf69bf607ac1fe061a6437e0a670b0022f (patch) | |
tree | ac0897eff214f09c89d5f4fbc3c03ef9d010a83c /include | |
parent | 06b72d06d6b182bdaaaec686dbd8b602949521ee (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 'include')
-rw-r--r-- | include/linux/ceph/libceph.h | 2 | ||||
-rw-r--r-- | include/linux/mfd/tps65910.h | 2 | ||||
-rw-r--r-- | include/scsi/scsi.h | 2 | ||||
-rw-r--r-- | include/sound/soundfont.h | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 6365f041745b..563755181c1e 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
@@ -35,7 +35,7 @@ | |||
35 | #define CEPH_OPT_MYIP (1<<2) /* specified my ip */ | 35 | #define CEPH_OPT_MYIP (1<<2) /* specified my ip */ |
36 | #define CEPH_OPT_NOCRC (1<<3) /* no data crc on writes */ | 36 | #define CEPH_OPT_NOCRC (1<<3) /* no data crc on writes */ |
37 | 37 | ||
38 | #define CEPH_OPT_DEFAULT (0); | 38 | #define CEPH_OPT_DEFAULT (0) |
39 | 39 | ||
40 | #define ceph_set_opt(client, opt) \ | 40 | #define ceph_set_opt(client, opt) \ |
41 | (client)->options->flags |= CEPH_OPT_##opt; | 41 | (client)->options->flags |= CEPH_OPT_##opt; |
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index 8bb85b930c07..73572c65d04f 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h | |||
@@ -269,7 +269,7 @@ | |||
269 | #define LDO1_SEL_MASK 0xFC | 269 | #define LDO1_SEL_MASK 0xFC |
270 | #define LDO3_SEL_MASK 0x7C | 270 | #define LDO3_SEL_MASK 0x7C |
271 | #define LDO_MIN_VOLT 1000 | 271 | #define LDO_MIN_VOLT 1000 |
272 | #define LDO_MAX_VOLT 3300; | 272 | #define LDO_MAX_VOLT 3300 |
273 | 273 | ||
274 | 274 | ||
275 | /*Register VDIG1 (0x80) register.RegisterDescription */ | 275 | /*Register VDIG1 (0x80) register.RegisterDescription */ |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 3668903e397b..8001ae4cd7ba 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -495,7 +495,7 @@ static inline int scsi_is_wlun(unsigned int lun) | |||
495 | 495 | ||
496 | #define sense_class(sense) (((sense) >> 4) & 0x7) | 496 | #define sense_class(sense) (((sense) >> 4) & 0x7) |
497 | #define sense_error(sense) ((sense) & 0xf) | 497 | #define sense_error(sense) ((sense) & 0xf) |
498 | #define sense_valid(sense) ((sense) & 0x80); | 498 | #define sense_valid(sense) ((sense) & 0x80) |
499 | 499 | ||
500 | /* | 500 | /* |
501 | * default timeouts | 501 | * default timeouts |
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h index f95d99ba7f74..679df0574066 100644 --- a/include/sound/soundfont.h +++ b/include/sound/soundfont.h | |||
@@ -121,7 +121,7 @@ int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, | |||
121 | int snd_sf_calc_parm_hold(int msec); | 121 | int snd_sf_calc_parm_hold(int msec); |
122 | int snd_sf_calc_parm_attack(int msec); | 122 | int snd_sf_calc_parm_attack(int msec); |
123 | int snd_sf_calc_parm_decay(int msec); | 123 | int snd_sf_calc_parm_decay(int msec); |
124 | #define snd_sf_calc_parm_delay(msec) (0x8000 - (msec) * 1000 / 725); | 124 | #define snd_sf_calc_parm_delay(msec) (0x8000 - (msec) * 1000 / 725) |
125 | extern int snd_sf_vol_table[128]; | 125 | extern int snd_sf_vol_table[128]; |
126 | int snd_sf_linear_to_log(unsigned int amount, int offset, int ratio); | 126 | int snd_sf_linear_to_log(unsigned int amount, int offset, int ratio); |
127 | 127 | ||