[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] docs/style: allow C99 mixed declarations
From: |
Samuel Tardieu |
Subject: |
Re: [PATCH] docs/style: allow C99 mixed declarations |
Date: |
Mon, 05 Feb 2024 19:12:21 +0100 |
User-agent: |
mu4e 1.10.8; emacs 29.1 |
Daniel P. Berrangé <berrange@redhat.com> writes:
$ gcc -Wall -Wuninitialized -o jump jump.c
Note that many GCC warnings don't trigger if you don't enable
optimizations. In the case you exhibit, adding -O is enough to get
a sensible warning:
$ gcc -Wall -O -o jump jump.c
jump.c: In function ‘main’:
jump.c:11:3: warning: ‘foo’ may be used uninitialized
[-Wmaybe-uninitialized]
11 | free(foo);
| ^~~~~~~~~
jump.c:8:9: note: ‘foo’ was declared here
8 | char *foo = malloc(30);
| ^~~
Best.
Sam
--
Samuel Tardieu