xref: /dflybsd-src/gnu/usr.bin/diff/libdiffutils/strings.h (revision c0d274d062fd959993bf623f25f7cb6a8a676c4e)
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* -*- buffer-read-only: t -*- vi: set ro: */
3 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
4 /* A substitute <strings.h>.
5 
6    Copyright (C) 2007-2010 Free Software Foundation, Inc.
7 
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3, or (at your option)
11    any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software Foundation,
20    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
21 
22 #ifndef _GL_STRINGS_H
23 
24 #if __GNUC__ >= 3
25 #pragma GCC system_header
26 #endif
27 
28 /* The include_next requires a split double-inclusion guard.  */
29 #include_next <strings.h>
30 
31 #ifndef _GL_STRINGS_H
32 #define _GL_STRINGS_H
33 
34 
35 /* The definition of _GL_ARG_NONNULL is copied here.  */
36 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
37    that the values passed as arguments n, ..., m must be non-NULL pointers.
38    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
39 #ifndef _GL_ARG_NONNULL
40 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
41 #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
42 # else
43 #  define _GL_ARG_NONNULL(params)
44 # endif
45 #endif
46 
47 /* The definition of _GL_WARN_ON_USE is copied here.  */
48 #ifndef _GL_WARN_ON_USE
49 
50 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
51 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
52 #  define _GL_WARN_ON_USE(function, message) \
53 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
54 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
55 /* Verify the existence of the function.  */
56 #  define _GL_WARN_ON_USE(function, message) \
57 extern __typeof__ (function) function
58 # else /* Unsupported.  */
59 #  define _GL_WARN_ON_USE(function, message) \
60 _GL_WARN_EXTERN_C int _gl_warn_on_use
61 # endif
62 #endif
63 
64 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
65    is like _GL_WARN_ON_USE (function, "string"), except that the function is
66    declared with the given prototype, consisting of return type, parameters,
67    and attributes.
68    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
69    not work in this case.  */
70 #ifndef _GL_WARN_ON_USE_CXX
71 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
72 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
73 extern rettype function parameters_and_attributes \
74      __attribute__ ((__warning__ (msg)))
75 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
76 /* Verify the existence of the function.  */
77 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
78 extern rettype function parameters_and_attributes
79 # else /* Unsupported.  */
80 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
81 _GL_WARN_EXTERN_C int _gl_warn_on_use
82 # endif
83 #endif
84 
85 /* _GL_WARN_EXTERN_C declaration;
86    performs the declaration with C linkage.  */
87 #ifndef _GL_WARN_EXTERN_C
88 # if defined __cplusplus
89 #  define _GL_WARN_EXTERN_C extern "C"
90 # else
91 #  define _GL_WARN_EXTERN_C extern
92 # endif
93 #endif
94 
95 #ifdef __cplusplus
96 extern "C" {
97 #endif
98 
99 
100 /* Compare strings S1 and S2, ignoring case, returning less than, equal to or
101    greater than zero if S1 is lexicographically less than, equal to or greater
102    than S2.
103    Note: This function does not work in multibyte locales.  */
104 #if ! 1
105 extern int strcasecmp (char const *s1, char const *s2)
106      _GL_ARG_NONNULL ((1, 2));
107 #endif
108 #if defined GNULIB_POSIXCHECK
109 /* strcasecmp() does not work with multibyte strings:
110    POSIX says that it operates on "strings", and "string" in POSIX is defined
111    as a sequence of bytes, not of characters.   */
112 # undef strcasecmp
113 # if HAVE_RAW_DECL_STRCASECMP
114 _GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
115                  "strings in multibyte locales - "
116                  "use mbscasecmp if you care about "
117                  "internationalization, or use c_strcasecmp , "
118                  "gnulib module c-strcase) if you want a locale "
119                  "independent function");
120 # endif
121 #endif
122 
123 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
124    returning less than, equal to or greater than zero if S1 is
125    lexicographically less than, equal to or greater than S2.
126    Note: This function cannot work correctly in multibyte locales.  */
127 #if ! 1
128 extern int strncasecmp (char const *s1, char const *s2, size_t n)
129      _GL_ARG_NONNULL ((1, 2));
130 #endif
131 #if defined GNULIB_POSIXCHECK
132 /* strncasecmp() does not work with multibyte strings:
133    POSIX says that it operates on "strings", and "string" in POSIX is defined
134    as a sequence of bytes, not of characters.  */
135 # undef strncasecmp
136 # if HAVE_RAW_DECL_STRNCASECMP
137 _GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
138                  "strings in multibyte locales - "
139                  "use mbsncasecmp or mbspcasecmp if you care about "
140                  "internationalization, or use c_strncasecmp , "
141                  "gnulib module c-strcase) if you want a locale "
142                  "independent function");
143 # endif
144 #endif
145 
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif /* _GL_STRING_H */
152 #endif /* _GL_STRING_H */
153