[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#6483) [PATCH] Properly use #elif



delphij@FreeBSD.org wrote:
> Full_Name: Xin LI
> Version: -HEAD
> OS: FreeBSD/amd64
> URL: http://people.freebsd.org/~delphij/misc/openldap-elif.diff
> Submission from: (NULL) (206.40.55.65)
>
>
> OpenLDAP uses several #elif to test if a macro is being defined, which should be
> spelled as #elif defined.
>
> Here is a patch against CVS -HEAD.
>
> Index: include/ac/regex.h
> ===================================================================
> RCS file: /repo/OpenLDAP/pkg/ldap/include/ac/regex.h,v
> retrieving revision 1.20
> diff -u -p -u -p -r1.20 regex.h
> --- include/ac/regex.h	21 Jan 2009 23:40:18 -0000	1.20
> +++ include/ac/regex.h	1 Mar 2010 20:12:52 -0000
> @@ -28,7 +28,7 @@
>    */
>   #error "No POSIX REGEX available."
>
> -#elif HAVE_GNUREGEX_H
> +#elif defined(HAVE_GNUREGEX_H)
>   	/* system has GNU gnuregex.h */
>   #	include<gnuregex.h>
>   #else

That patch is incorrect. Autoconf HAVE_xx macros must be defined to 1 to 
actually be used, some scripts may also define them to 0. The current test is 
correct.

Closing this ITS.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/