Skip to content

Commit b3d95cf

Browse files
committed
Fix build
1 parent b5f0e1d commit b3d95cf

File tree

4 files changed

+72
-2
lines changed

4 files changed

+72
-2
lines changed

gnurx_internal.h

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
2+
This file is part of the GNU C Library.
3+
4+
The GNU C Library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
The GNU C Library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with the GNU C Library; if not, see
16+
<http://www.gnu.org/licenses/>. */
17+
18+
#ifndef _GNURX_INTERNAL_H
19+
#define _GNURX_INTERNAL_H 1
20+
21+
#define _GNU_SOURCE
22+
#define IS_IN(x) 1
23+
24+
/* GNURX: from glibc-2.22/misc/sys/param.h */
25+
/* Macros for min/max. */
26+
#define MIN(a,b) (((a)<(b))?(a):(b))
27+
#define MAX(a,b) (((a)>(b))?(a):(b))
28+
29+
/* GNURX: from glibc-2.22/include/features.h */
30+
/* Convenience macros to test the versions of glibc and gcc.
31+
Use them like this:
32+
#if __GNUC_PREREQ (2,8)
33+
... code requiring gcc 2.8 or later ...
34+
#endif
35+
Note - they won't work for gcc1 or glibc1, since the _MINOR macros
36+
were not defined then. */
37+
#if defined __GNUC__ && defined __GNUC_MINOR__
38+
# define __GNUC_PREREQ(maj, min) \
39+
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
40+
#else
41+
# define __GNUC_PREREQ(maj, min) 0
42+
#endif
43+
44+
/* GNURX: from glibc-2.22/misc/sys/cdefs.h */
45+
/* If fortification mode, we warn about unused results of certain
46+
function calls which can lead to problems. */
47+
#if __GNUC_PREREQ (3,4)
48+
# define __attribute_warn_unused_result__ \
49+
__attribute__ ((__warn_unused_result__))
50+
# if __USE_FORTIFY_LEVEL > 0
51+
# define __wur __attribute_warn_unused_result__
52+
# endif
53+
#else
54+
# define __attribute_warn_unused_result__ /* empty */
55+
#endif
56+
#ifndef __wur
57+
# define __wur /* Ignore */
58+
#endif
59+
60+
#endif /* gnurx_internal.h */

regex.c

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "config.h"
2222
#endif
2323

24+
#include "gnurx_internal.h"
25+
2426
/* Make sure noone compiles this code with a C++ compiler. */
2527
#ifdef __cplusplus
2628
# error "This is C code, use a C compiler"

regex.h

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222

2323
#include <sys/types.h>
2424

25+
/* GNURX: from glibc-2.22/include/features.h */
26+
#undef __USE_GNU
27+
#ifdef _GNU_SOURCE
28+
# define __USE_GNU 1
29+
#endif
30+
2531
/* Allow the use in C++ code. */
2632
#ifdef __cplusplus
2733
extern "C" {

regex_internal.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,12 @@ static unsigned int re_string_context_at (const re_string_t *input, int idx,
419419
#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
420420
#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
421421

422-
#ifdef __GNUC__
422+
#ifdef alloca
423+
# define HAVE_ALLOCA 1
424+
#elif defined __GNUC__
423425
# define alloca(size) __builtin_alloca (size)
424426
# define HAVE_ALLOCA 1
425-
#elif defined(_MSC_VER)
427+
#elif defined _MSC_VER
426428
# include <malloc.h>
427429
# define alloca _alloca
428430
# define HAVE_ALLOCA 1

0 commit comments

Comments
 (0)