Re: No warning for module global variable which is set but never used

2020-12-10 Thread webmaster
Ahhh, ok. Good too know. I think also it is not of high priority ;-) Greets Patrick Am 10.12.2020 um 16:26 schrieb David Brown: > On 10/12/2020 16:10, webmaster wrote: > > (As a general rule, you'll get more useful responses if you use your > name in your posts. It's common courtesy.) > >

Re: No warning for module global variable which is set but never used

2020-12-10 Thread David Brown
On 10/12/2020 16:10, webmaster wrote: (As a general rule, you'll get more useful responses if you use your name in your posts. It's common courtesy.) > Is it possible to request such feature? > Of course you can file a request for it. Go to the gcc bugzilla site:

Re: No warning for module global variable which is set but never used

2020-12-10 Thread webmaster
Is it possible to request such feature? Am 09.12.2020 um 16:45 schrieb webmaster: > I have the following Code C\C++: > > static int foo = 0; > > static void bar(void) > { > foo = 1; > } > > Here it is clear for the compiler that the variable foo can only be > accessed from the same modul

Re: No warning for module global variable which is set but never used

2020-12-09 Thread webmaster
I have the following Code C\C++: static int foo = 0; static void bar(void) { foo = 1; } Here it is clear for the compiler that the variable foo can only be accessed from the same modul and not from ther modules. From the explanations before I understand that the variable is removed due to

Re: No warning for module global variable which is set but never used

2020-12-09 Thread webmaster
I'm talking about C/C++ :-) Ursprüngliche Nachricht Von: Tobias Burnus Datum: 09.12.20 13:15 (GMT+01:00) An: webmaster Betreff: Re: No warning for module global variable which is set but never used The example below is for Fortran – but the same applies to C++ modulesand

Re: No warning for module global variable which is set but never used

2020-12-09 Thread webmaster
Ahh, ok. With these explanation I understand that the compiler does remove it because of optimatizion. This is somehow good and bad.  Good that unused variable does not consume any memory. Bad that developer is not informed that variable can be removed. Ursprüngliche Nachricht

Re: No warning for module global variable which is set but never used

2020-12-09 Thread David Brown
On 09/12/2020 11:00, Jakub Jelinek wrote: > On Wed, Dec 09, 2020 at 10:50:22AM +0100, David Brown wrote: >> I'd say that it makes sense to have such a warning as a natural >> enhancement to the existing "-Wunused-but-set-variable" warning. But I > > That is not really possible. > The

Re: No warning for module global variable which is set but never used

2020-12-09 Thread Jakub Jelinek via Gcc
On Wed, Dec 09, 2020 at 10:50:22AM +0100, David Brown wrote: > I'd say that it makes sense to have such a warning as a natural > enhancement to the existing "-Wunused-but-set-variable" warning. But I That is not really possible. The -Wunused-but-set-* warning works by having two bits for the

Re: No warning for module global variable which is set but never used

2020-12-09 Thread David Brown
On 09/12/2020 10:25, webmaster wrote: > Hello,I'm wondering why GCC does not throw any warning when a module global > variable is set (write) but never used (read).Is this behavior wanted? Does > it makes sense to add such warning?Greets > How do you expect the compiler to know if the variable

Re: No warning for module global variable which is set but never used

2020-12-09 Thread Jonathan Wakely via Gcc
On Wed, 9 Dec 2020 at 09:28, webmaster wrote: > > Hello,I'm wondering why GCC does not throw any warning when a module global > variable is set (write) but never used (read).Is this behavior wanted? Does > it makes sense to add such warning?Greets This question seems to be more appropriate for

No warning for module global variable which is set but never used

2020-12-09 Thread webmaster
Hello,I'm wondering why GCC does not throw any warning when a module global variable is set (write) but never used (read).Is this behavior wanted? Does it makes sense to add such warning?Greets