This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On 11/05/2017 03:32 PM, Steve Kargl wrote:
On Sun, Nov 05, 2017 at 11:05:02AM +0100, Tom de Vries wrote:this patch removes a semicolon after "do {} while (0)" in match macros.The patch contains this part.This allows the macros to be used in if-then-elses without curly braces.The patch does not contain any changes that support this statement.
I'm not listing two changes here, but a change and a consequence.
I'm merely pointing out that this compiles:
...
$ cat do-while-0.c
#define BLA do {} while (0);
void
foo (void)
{
if (1)
{
BLA;
}
else
;
}
$ gcc do-while-0.c -S
$
...
but this does not:
...
$ cat do-while-0.2.c
#define BLA do {} while (0);
void
foo (void)
{
if (1)
BLA;
else
;
}
$ gcc do-while-0.2.c -S
do-while-0.2.c: In function ‘foo’:
do-while-0.2.c:8:3: error: ‘else’ without a previous ‘if’
else
^
$
...
and then again this does:
...
$ cat do-while-0.3.c
#define BLA do {} while (0)
void
foo (void)
{
if (1)
BLA;
else
;
}
$ gcc do-while-0.3.c -S
$
...
Thanks,
- Tom
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |