bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] Re: const qualifier violation in regex.c:re_comp()


From: Bruno Haible
Subject: Re: [Bug-gnulib] Re: const qualifier violation in regex.c:re_comp()
Date: Tue, 5 Oct 2004 17:28:23 +0200
User-agent: KMail/1.5

> There is another change to regex.c that was reported against regex.c
> that might be well to fix in the GNULIB version.
>
> Index: lib/regex.c
> ===================================================================
> RCS file: /cvsroot/gnulib/gnulib/lib/regex.c,v
> retrieving revision 1.84
> diff -u -p -r1.84 regex.c
> --- lib/regex.c       4 Oct 2004 21:00:42 -0000       1.84
> +++ lib/regex.c       5 Oct 2004 14:57:42 -0000
> @@ -4970,7 +4970,7 @@ weak_alias (__re_search_2, re_search_2)
>  #ifdef INSIDE_RECURSION
>
>  #ifdef MATCH_MAY_ALLOCATE
> -# define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
> +# define FREE_VAR(var) if (var) (void)REGEX_FREE ((void *)var); var = NULL
>  #else
>  # define FREE_VAR(var) if (var) free (var); var = NULL
>  #endif

I vote against such changes because

  1) MSVC emits warnings for many constructs which are perfectly valid C
     and don't indicate a bug in most cases (such as passing a 'short'
     value as argument to a function which expects an 'int', or vice versa),

  2) The GNU standards say on this topic: "The compiler should be your servant,
     not your master."

GCC's -Wall produces a reasonable set of warnings, MSVC -W2 or -W3 doesn't.

Bruno





reply via email to

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