Hello.
How to disable the Warning: (6060) Case statement does not handle all possible cases ?
I did try with this without luck, the warning is still there:
interface
{$warn 6060 off}Fre;D
-----
Many thanks ;-)

Mailing lists / fpc-pascal / 2020-03
10 messages · 2 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hello.
How to disable the Warning: (6060) Case statement does not handle all possible cases ?
I did try with this without luck, the warning is still there:
interface
{$warn 6060 off}Fre;D
-----
Many thanks ;-)
Hello.
According to:
https://wiki.freepascal.org/Turn_warnings_and_hints_on_or_off
So doing this:
unit myunit; {$warn 6060 off}
Still gives some "Warning: (6060) Case statement does not handle all possible cases"
How to disable it?
Thanks.
-----
Many thanks ;-)
It works for me:
$ cat tt.pp
{$warn 6060 off}
var
b: 1..10;
begin
case b of
1: writeln('hello');
end
end.$ ppcx20 -l -vwq tt
Free Pascal Compiler version 3.3.1 [2020/02/15] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others (1002) Target OS: Darwin for x86_64
(3104) Compiling tt.pp
tt.pp(6,8) Warning: (5037) Variable "b" does not seem to be initialized (9009) Assembling program
(9015) Linking tt
(1008) 9 lines compiled, 0.1 sec
(1021) 1 warning(s) issued
Jonas
It works for me: $ cat tt.pp {$warn 6060 off}
Ha, on Linux too?
By the way, what is "$ cat tt.pp", is it needed to disable the warning? And where did you place the code, just after "units" like explained in doc.
Will it disable all the warnings concerned for all the code of the unit?
Fre;D
-----
Many thanks ;-)
"cat" is a program that shows the contents of a file. It was to show you the source code that I was compiling.
And where did you place the code, just after "units" like explained in doc.
It was placed where you can see it in the program (it's a program, not a unit).
Will it disable all the warnings concerned for all the code of the unit?
Yes.
Jonas
cat" is a program
Ha, ok.
> Will it disable all the warnings concerned for all the code of the unit? Yes.
Hum, here, adding {$warn 6060 off} after "unit", on Linux 64 bit, compiled with fpc 3.3.1 trunk of 7 days ago, the warnings are still there.
Fre;D
-----
Many thanks ;-)
fredvs wrote>> Will it disable all the warnings concerned for all the code of the unit? > Yes. Hum, here, adding {$warn 6060 off} after "unit", on Linux 64 bit, compiled with fpc 3.3.1 trunk of 7 days ago, the warnings are still there.
If you have a uses clause, try adding it after the uses clause.
Jonas
It works for me: $ cat tt.pp {$warn 6060 off} var b: 1..10; begin case b of 1:…
It works for me:
It seems that you did try to use {$warn 6060 off} in a program-file.
But did you try with a unit-file?
Fre;D
-----
Many thanks ;-)
$ cat tt.pp
unit tt;
{$warn 6060 off}
interface
uses
sysutils;
implementation
procedure test;
var
b: 1..10;
begin
case b of
1: writeln('hello');
end
end;
end.$ ../compiler/ppcx64 -l -vw tt
Free Pascal Compiler version 3.3.1 [2020/03/27] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Darwin for x86_64
Compiling tt.pp
tt.pp(16,8) Warning: Local variable "b" does not seem to be initialized Assembling tt
21 lines compiled, 0.1 sec
1 warning(s) issued
Jonas
If you have a uses clause, try adding it after the uses clause. Jonas
If you have a uses clause, try adding it after the uses clause.
Yep, indeed that did the trick.
But note also that it must be after the "uses" clause after "implementation" (otherwise after first "uses" it does not work).
Also, to make earlier fpc versions happy, this must be added:
{$if fpc_fullversion >= 030300}
{$warn 6060 off}
{$endif}OK, thanks Jonas.
Fre;D
-----
Many thanks ;-)