[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Windows Build: lib/regex.c warnings, "free" calls

From: Conrad T. Pino
Subject: Windows Build: lib/regex.c warnings, "free" calls
Date: Sun, 4 Apr 2004 18:04:30 -0700

Line 4260:        FREE_VARIABLES ();
ccvs 1.12\lib\regex.c(4260) : warning C4090: 'function' : different 'const' 
ccvs 1.12\lib\regex.c(4260) : warning C4022: 'free' : pointer mismatch for 
actual parameter 1
repeats an additional 6 times for line 4260

The same warning sequence repeats for lines: 4277, 4434, 4450, 4508, 5743
which are all the same as line 4260.

It looks like a finicky VC 6.0 which is illustrated by the following:

int main(int argc, char* argv[])
        const char **buffer;
        buffer = malloc( 256 );
        free( buffer );
        return 0;

which gives warnings of:
test.c(5): warning C4090: 'function' : different 'const' qualifiers
test.c(5): warning C4022: 'free' : pointer mismatch for actual parameter 1

The warning is triggered by the "const" qualifier in the declaration which
seems like a lame warning to me.  I'd like to see these warnings suppressed
and I see three options to address them.
Option 0: Nothing

Do nothing to the code other than add comments that warnings are expected.
Option 1: Usage #pragma

The warnings can be disabled in VC 6.0 with:

   #pragma warning( disable: 4022 4090 )

but it's not portable to other compilers and would suppress the warnings
in later code where we might want to see them.
Option 2: Modify macros

In the file "FREE_VARIABLES" is a macro that invokes other macros that
resolve to calls to "free".  The final macros can be modified to include
a (void *) cast that would suppress the warnings but only for the specific
cases where we don't want the warnings.
Question 1: Should the warnings be suppressed?

Question 2: If yes, using Option 1 or Option 2?

Conrad Pino

reply via email to

[Prev in Thread] Current Thread [Next in Thread]