[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: quotearg: shell escape issue with single quote
From: |
Bruno Haible |
Subject: |
Re: quotearg: shell escape issue with single quote |
Date: |
Wed, 03 Apr 2024 23:33:11 +0200 |
Hi Pádraig,
> The attached should fix this issue.
> process_input:
> + bool pending_shell_escape_end = false;
It has a syntax error: With clang and with GCC versions < 11, it is invalid
to put a declaration after a label. See:
=================== foo.c =================
int main ()
{
goto label;
label:
int ret = 0;
return ret;
}
===========================================
$ gcc -c foo.c
foo.c: In function ‘main’:
foo.c:6:3: error: a label can only be part of a statement and a declaration is
not a statement
6 | int ret = 0;
| ^~~
$ clang -c foo.c
foo.c:6:3: error: expected expression
6 | int ret = 0;
| ^
foo.c:7:10: error: use of undeclared identifier 'ret'
7 | return ret;
| ^
2 errors generated.
The workaround is trivial: Add a semicolon after the colon:
process_input: ;
bool pending_shell_escape_end = false;
Bruno