Actually,what was the state of warnings? if it was off in the first place (because maybe a compiler switch instead of sourcecode directive) turning it on would be wrong.
As I explained before, you are using conditionals in a, let's say, funny way, using too much or assuming too little.
If you want full control over warnings there are several options, (I wrote the wiki part on those, have a look there
http://wiki.freepascal.org/Turn_warnings_and_hints_on_or_off )
Simple example:
{$push} // don't assume on or off, but save state
{$warnings off}
// ... do something that normally throws a warning
{$pop} // restore state: if it was off it stays off, if it was on, it's on again.
Or:
{$push}{$warn 5092 off}
// .. Do something with uninitialized managed type .... would otherwise throw (5092) Variable "L" of a managed type does not seem to be initialized
{$pop}
In Lazarus IDE and only in the Lazarus IDE there's a Lazarus specific macro option as well that doesn't work in other editors, like fp or geany or notepad++. See also the wiki.
That option is therefor not recommended.
To "fix" your code and introduce a bug:
{$PUSH}{$WARN 5037 OFF}
// Warning: (5037) Variable "SomePointer" does not seem to be initialized
// generates a genuine warning otherwise: the content of SomePointer^ is not known...
// that's a bug!! The compiler will now assume this particular variable to be initialized... everywhere.
writeln(sizeof(SomePointer^));
{$POP} // means further variable, but NOT this one will again raise to the warning
To really fix your code, initialize the content of SomePointer^ as the compiler told you.
SomePointer^ := 0;
writeln(sizeof(SomePointer^));
Or
writeln(SizeOf(PDWORD^));// now the second occurance will throw the warning..
Once you tell the compiler to ignore initialization for a variable it is internally registered as initialized, so the compiler will ignore further occurances. That is the reason of your confusion the second time it occurs, but that is fully consistent compiler behavior. You marked it as ignore... Any further warning of the same kind for the same variable will be further ignored.
You can't "
uninitialize" a variable very easily.... and what you did was telling the compiler, never mind, accept that I mean it is initialized, so that's what the compiler does....
I hope this is clear. I also hope it is clear that it is very dangerous to turn ALL warnings on or off as it can lead to a myriad of hard to find bugs.
But the compiler is consistent and above all: correct...