[Top][All Lists]

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

Re: warning: 'fnmatch' macro redefined

From: Bruno Haible
Subject: Re: warning: 'fnmatch' macro redefined
Date: Sun, 19 Aug 2018 03:24:39 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-130-generic; KDE/5.18.0; x86_64; ; )

Reuben Thomas wrote:
> breaks on Darwin:
> In file included from glob.c:81:
> In file included from ./scratch_buffer.h:4:
> In file included from ./libc-config.h:33:
> ../config.h:927:9: warning: 'fnmatch' macro redefined [-Wmacro-redefined]
> #define fnmatch posix_fnmatch
>         ^
> ./fnmatch.h:554:12: note: previous definition is here
> #   define fnmatch rpl_fnmatch
>            ^

"Breaks" is a strong word, when it's just a warning. But you're right,
it's better to fix it.

The first definition, in config.h, is an old-style definition, from
the time before we had the *.in.h idioms. Since no one really cares
whether the replacement function is called 'rpl_fnmatch', 'posix_fnmatch',
or 'gnu_fnmatch' (the only important thing is that it is not called
'fnmatch'), the fix is to just remove that definition:

2018-08-18  Bruno Haible  <address@hidden>

        fnmatch: Avoid conflicting macro definitions of 'fnmatch'.
        Reported by Reuben Thomas <address@hidden> in
        * m4/fnmatch.m4 (gl_PREREQ_FNMATCH): Don't define 'fnmatch' as a macro
        in config.h.

diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4
index 9414514..f05f845 100644
--- a/m4/fnmatch.m4
+++ b/m4/fnmatch.m4
@@ -1,4 +1,4 @@
-# Check for fnmatch - serial 11.  -*- coding: utf-8 -*-
+# Check for fnmatch - serial 12.  -*- coding: utf-8 -*-
 # Copyright (C) 2000-2007, 2009-2018 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -140,11 +140,6 @@ AC_DEFUN([gl_FUNC_FNMATCH_GNU],
-  dnl We must choose a different name for our function, since on ELF systems
-  dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
-  dnl compiled into a shared library.
-  AC_DEFINE_UNQUOTED([fnmatch], [${gl_fnmatch_required_lowercase}_fnmatch],
-    [Define to a replacement function name for fnmatch().])
   dnl Prerequisites of lib/fnmatch.c.
   AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]])

reply via email to

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