protect the entire contents of regsub.c with extern "C". this fixes the tools build, at least. also, remove the no longer needed cdefs.h from one of these copies.diff -r1.3 -r1.4 src/external/gpl3/gcc.old/dist/gcc/regsub.c
(mrg)
--- src/external/gpl3/gcc.old/dist/gcc/regsub.c 2016/01/20 15:12:29 1.3
+++ src/external/gpl3/gcc.old/dist/gcc/regsub.c 2016/01/21 04:55:40 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: regsub.c,v 1.3 2016/01/20 15:12:29 christos Exp $ */ | 1 | /* $NetBSD: regsub.c,v 1.4 2016/01/21 04:55:40 mrg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2015 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Christos Zoulas. | 8 | * by Christos Zoulas. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -18,27 +18,29 @@ | @@ -18,27 +18,29 @@ | |||
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | #include <sys/cdefs.h> | 31 | ||
32 | extern "C" { | |||
33 | ||||
32 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
33 | #include <ctype.h> | 35 | #include <ctype.h> | |
34 | #include <stdlib.h> | 36 | #include <stdlib.h> | |
35 | #include <string.h> | 37 | #include <string.h> | |
36 | #include <regex.h> | 38 | #include <regex.h> | |
37 | 39 | |||
38 | struct str { | 40 | struct str { | |
39 | char *s_ptr; | 41 | char *s_ptr; | |
40 | size_t s_max; | 42 | size_t s_max; | |
41 | size_t s_len; | 43 | size_t s_len; | |
42 | int s_fixed; | 44 | int s_fixed; | |
43 | }; | 45 | }; | |
44 | 46 | |||
@@ -148,13 +150,15 @@ regsub1(char **buf, size_t len, const ch | @@ -148,13 +150,15 @@ regsub1(char **buf, size_t len, const ch | |||
148 | ssize_t | 150 | ssize_t | |
149 | regnsub(char *buf, size_t len, const char *sub, const regmatch_t *rm, | 151 | regnsub(char *buf, size_t len, const char *sub, const regmatch_t *rm, | |
150 | const char *str) | 152 | const char *str) | |
151 | { | 153 | { | |
152 | return regsub1(&buf, len, sub, rm, str); | 154 | return regsub1(&buf, len, sub, rm, str); | |
153 | } | 155 | } | |
154 | 156 | |||
155 | ssize_t | 157 | ssize_t | |
156 | regasub(char **buf, const char *sub, const regmatch_t *rm, const char *str) | 158 | regasub(char **buf, const char *sub, const regmatch_t *rm, const char *str) | |
157 | { | 159 | { | |
158 | *buf = NULL; | 160 | *buf = NULL; | |
159 | return regsub1(buf, REINCR, sub, rm, str); | 161 | return regsub1(buf, REINCR, sub, rm, str); | |
160 | } | 162 | } | |
163 | ||||
164 | } |
--- src/external/gpl3/gcc/dist/gcc/regsub.c 2016/01/20 15:13:33 1.3
+++ src/external/gpl3/gcc/dist/gcc/regsub.c 2016/01/21 04:55:40 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: regsub.c,v 1.3 2016/01/20 15:13:33 christos Exp $ */ | 1 | /* $NetBSD: regsub.c,v 1.4 2016/01/21 04:55:40 mrg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2015 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Christos Zoulas. | 8 | * by Christos Zoulas. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -18,26 +18,29 @@ | @@ -18,26 +18,29 @@ | |||
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | ||||
32 | extern "C" { | |||
33 | ||||
31 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
32 | #include <ctype.h> | 35 | #include <ctype.h> | |
33 | #include <stdlib.h> | 36 | #include <stdlib.h> | |
34 | #include <string.h> | 37 | #include <string.h> | |
35 | #include <regex.h> | 38 | #include <regex.h> | |
36 | 39 | |||
37 | struct str { | 40 | struct str { | |
38 | char *s_ptr; | 41 | char *s_ptr; | |
39 | size_t s_max; | 42 | size_t s_max; | |
40 | size_t s_len; | 43 | size_t s_len; | |
41 | int s_fixed; | 44 | int s_fixed; | |
42 | }; | 45 | }; | |
43 | 46 | |||
@@ -147,13 +150,15 @@ regsub1(char **buf, size_t len, const ch | @@ -147,13 +150,15 @@ regsub1(char **buf, size_t len, const ch | |||
147 | ssize_t | 150 | ssize_t | |
148 | regnsub(char *buf, size_t len, const char *sub, const regmatch_t *rm, | 151 | regnsub(char *buf, size_t len, const char *sub, const regmatch_t *rm, | |
149 | const char *str) | 152 | const char *str) | |
150 | { | 153 | { | |
151 | return regsub1(&buf, len, sub, rm, str); | 154 | return regsub1(&buf, len, sub, rm, str); | |
152 | } | 155 | } | |
153 | 156 | |||
154 | ssize_t | 157 | ssize_t | |
155 | regasub(char **buf, const char *sub, const regmatch_t *rm, const char *str) | 158 | regasub(char **buf, const char *sub, const regmatch_t *rm, const char *str) | |
156 | { | 159 | { | |
157 | *buf = NULL; | 160 | *buf = NULL; | |
158 | return regsub1(buf, REINCR, sub, rm, str); | 161 | return regsub1(buf, REINCR, sub, rm, str); | |
159 | } | 162 | } | |
163 | ||||
164 | } |