[Top][All Lists]

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

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

From: Conrad T. Pino
Subject: RE: Windows Build: lib/regex.c warnings, "free" calls
Date: Tue, 6 Apr 2004 19:15:10 -0700

Hi Derek,

> From: Derek Robert Price [mailto:derek@ximbiot.com]
> >>From: Conrad T. Pino
> >>
> >>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.
> >
> >
> >Option 2 looks like a 1 line change with 2 possible candidates:
> >
> >Index: lib/regex.c
> >===================================================================
> >RCS file: /cvs/ccvs/lib/regex.c,v
> >retrieving revision 1.12
> >diff -u -p -r1.12 regex.c
> >--- lib/regex.c    8 Aug 2002 19:55:42 -0000    1.12
> >+++ lib/regex.c    5 Apr 2004 01:43:34 -0000
> >@@ -263,7 +263,7 @@ init_syntax_once ()
> >
> > #define REGEX_ALLOCATE malloc
> > #define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
> >-#define REGEX_FREE free
> >+#define REGEX_FREE(arg) free ((void *) (arg))
> This is acceptable only if every call to REGEX_FREE is generating the
> warning.  Otherwise, the specific offensive calls should be cast
> individually.

The "...only if every call..." criteria is met for REGEX_FREE, FREE_VAR

The quick analysis done on both feature and stable branches finds:

Macro REGEX_FREE is invoked only by macro FREE_VAR.
Macro FREE_VAR is invoked only by macro FREE_VARIABLES.
Every macro FREE_VARIABLES invocation generates the warnings.

Supporting grep data may be found at end of this message.

> Also, this will probably be the correct fix on stable but somebody
> should see about updating the version on feature from GNULIB and then
> sending any changes that need to be made to suppress warnings back to the
> GNULIB maintainers.  See HACKING & srclist.txt for more.  Last time I
> looked, there were two version of the regex module in GNULIB, one from
> Emacs & one from, um, glibc, maybe.  They're working on merging them but
> last time I check they hadn't finished (they have made some progress -
> there used to be 3 versions).  Probably the easiest way to update regex
> is to try and figure out which version the GNULIB folks are trying to
> head for, then just install it in CVS and see if the sanity.sh tests
> pass.  If not try the other one.  If neither works, then more
> investigation would be necessary, I am sure...

OK, that's a lot to put in one paragraph.  I'm going to break out talking
points one at a time and place each in a separate paragraphs.

In general tracking external sources strikes me as a good idea.  In this
case I'm concerned about what is done about the warnings on the feature
branch until "somebody" appears to import the latest GNULIB version.

I looked at the current state of regex in GNULIB.  Two versions are still
there and both versions will generate the same "free" warnings as we have
now.  Assuming we import a new version, I'm concerned about what is done
about the warnings on the feature branch until the GNULIB maintainers do
provide a fix for what could be a lame Microsoft compiler warning.

I reread HACKING but I'm not clear about which section applies.  If I've
missed something important could you direct me to a line number?

I checked "srclist.txt" and found nothing there about "regex".  Could you
be more specific about what I should be seeking?

I'm assuming the suggested methodology for importing a new regex is to
encourage "somebody" to volunteer.  I'm not qualified perform the task
without mentoring and I'm reluctant to impose carelessly.

I propose a common quick fix on both branches, additional work on other
warnings and then a return to updating regex from GNULIB.

> Derek


REGEX_FREE has 2 alternative definitions and just 1 reference:

266     #define REGEX_FREE free
299     #define REGEX_FREE(arg) ((void)0) /* Do nothing!  But inhibit gcc 
warning.  */

4004    #define FREE_VAR(var) if (var) { REGEX_FREE (var); var = NULL; } else
FREE_VAR has just 1 definition and 9 references:

4004    #define FREE_VAR(var) if (var) { REGEX_FREE (var); var = NULL; } else

4008        FREE_VAR (regstart);                                                
4009        FREE_VAR (regend);                                                  
4010        FREE_VAR (old_regstart);                                            
4011        FREE_VAR (old_regend);                                              
4012        FREE_VAR (best_regstart);                                           
4013        FREE_VAR (best_regend);                                             
4014        FREE_VAR (reg_info);                                                
4015        FREE_VAR (reg_dummy);                                               
4016        FREE_VAR (reg_info_dummy);                                          
FREE_VARIABLES has just 2 alternative definitions and 6 references:

4005    #define FREE_VARIABLES()                                                
4019    #define FREE_VARIABLES() ((void)0) /* Do nothing!  But inhibit gcc 
warning.  */

4260              FREE_VARIABLES ();
4277          FREE_VARIABLES ();
4434                          FREE_VARIABLES ();
4450                              FREE_VARIABLES ();
4508              FREE_VARIABLES ();
5743      FREE_VARIABLES ();

reply via email to

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