Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown Newsgroups: comp.lang.c Subject: Re: how to make a macro work as a single line if stmt without braces Date: Mon, 23 Sep 2024 08:16:07 +0200 Organization: A noiseless patient Spider Lines: 24 Message-ID: References: <20240922080605.59@kylheku.com> <87zfnzpgmv.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 23 Sep 2024 08:16:08 +0200 (CEST) Injection-Info: dont-email.me; posting-host="e5920fb159a85938aa1aa69cf473670d"; logging-data="2741786"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qX/PNCE3gQbcb6E4u1S3FsbsfT+Q3SSg=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:0O/KiC4iJWplU8wMgVi3K5rZCcs= In-Reply-To: <87zfnzpgmv.fsf@nosuchdomain.example.com> Content-Language: en-GB Bytes: 2227 On 22/09/2024 22:39, Keith Thompson wrote: > Bart writes: >> On 22/09/2024 16:11, Kaz Kylheku wrote: > [...] >>> Also GCC has been able to diagnose misleading indentation for some >>> years now. >> >> How many years was that out of the last 52? How exactly do you turn it >> on? Since -Wall -Wpedantic -Wextra doesn't report it. > > The -Wmisleading-indentation option was added to gcc on 2015-05-12, > and incorporated into -Wall 2015-12-10. gcc 6.1.0 has the option > and includes it in -Wall; gcc 5.3.0 does not. (Are you using a gcc > release that old?) It uses the -ftabstop= option (defaulting to 8) > to determine whether indentation lines up or not. > > Inconsistent tabstops and mixing of spaces and tabs can certainly > cause problems. > That would be detected quite easily if the default for -ftabstop were, say, 27. Then the chance of accidentally matching indents with tabs and spaces would be negligible.