From 08096928d16b98392b8b640bc90091f2564f2c1c Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 6 Aug 2018 15:00:38 +0200 Subject: fnmatch-h: New module. * lib/fnmatch.in.h: Use the usual gnulib idioms for header file replacements. (FNM_*): Don't redefine if fnmatch exists and we are not overriding it. (fnmatch): Use the usual gnulib idiom for function declarations. Enable 'posixcheck' warning. * m4/fnmatch_h.m4: New file. * m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Require gl_FNMATCH_H. Remove code that is moved to fnmatch_h.m4. When fnmatch does not exist, don't bother testing whether it is working. Set HAVE_FNMATCH, REPLACE_FNMATCH as appropriate. * modules/fnmatch-h: New file. * modules/fnmatch (Files): Remove lib/fnmatch.in.h. (Dependencies): Add fnmatch-h. Remove extensions, snippet/*. Change conditions. (configure.ac): Test HAVE_FNMATCH and REPLACE_FNMATCH. Set module indicator. (Makefile.am): Remove code that is moved to fnmatch-h. * modules/fnmatch-gnu (configure.ac): Test HAVE_FNMATCH and REPLACE_FNMATCH. * doc/posix-headers/fnmatch.texi: Mention the 'fnmatch-h' module. * modules/posixcheck (Depends-on): Add fnmatch-h. --- lib/fnmatch.in.h | 67 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/fnmatch.in.h b/lib/fnmatch.in.h index 27d4838720..bd0f0bf7e6 100644 --- a/lib/fnmatch.in.h +++ b/lib/fnmatch.in.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2018 Free +/* Substitute for and wrapper around . + Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,15 +17,29 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ -#ifndef _FNMATCH_H -#define _FNMATCH_H 1 +#ifndef _@GUARD_PREFIX@_FNMATCH_H -/* The definition of _GL_ARG_NONNULL is copied here. */ +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ -#ifdef __cplusplus -extern "C" { +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_FNMATCH_H@ +# @INCLUDE_NEXT@ @NEXT_FNMATCH_H@ #endif +#ifndef _@GUARD_PREFIX@_FNMATCH_H +#define _@GUARD_PREFIX@_FNMATCH_H + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +#if !@HAVE_FNMATCH@ || @REPLACE_FNMATCH@ + /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in . */ #undef FNM_PATHNAME @@ -54,14 +69,40 @@ extern "C" { # define FNM_NOSYS (-1) #endif +#endif + + +#if @GNULIB_FNMATCH@ /* Match NAME against the file name pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ -extern int fnmatch (const char *__pattern, const char *__name, - int __flags) - _GL_ARG_NONNULL ((1, 2)); - -#ifdef __cplusplus -} +# if @REPLACE_FNMATCH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fnmatch rpl_fnmatch +# endif +_GL_FUNCDECL_RPL (fnmatch, int, + (const char *pattern, const char *name, int flags) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fnmatch, int, + (const char *pattern, const char *name, int flags)); +# else +# if !@HAVE_FNMATCH@ +_GL_FUNCDECL_SYS (fnmatch, int, + (const char *pattern, const char *name, int flags) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (fnmatch, int, + (const char *pattern, const char *name, int flags)); +# endif +_GL_CXXALIASWARN (fnmatch); +#elif defined GNULIB_POSIXCHECK +# undef fnmatch +# if HAVE_RAW_DECL_FNMATCH +_GL_WARN_ON_USE (fnmatch, + "fnmatch does not portably work - " + "use gnulib module fnmatch for portability or gnulib module fnmatch-gnu for a glibc compatible implementation"); +# endif #endif -#endif /* fnmatch.h */ + +#endif /* _@GUARD_PREFIX@_FNMATCH_H */ +#endif /* _@GUARD_PREFIX@_FNMATCH_H */ -- cgit v1.2.1