[PATCH 2/2] Fix conflicting types for 'getopt' error with gcc15 on OS/2
KO Myung-Hun <[email protected]> Sat, 17 Jan 2026 22:59:07 +0900
| Newsgroups | gmane.comp.gnu.make.bugs |
|---|---|
| Message-ID | <[email protected]> |
* src/getopt.c [__EMX__]: Include stdlib.h and unistd.h for getopt().
* src/getopt.h [__EMX__]: Declare the prototype getopt().
---
src/getopt.c | 2 +-
src/getopt.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/getopt.c b/src/getopt.c
index ccf4660f..87abb4b5 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -61,7 +61,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
+#if defined (__GNU_LIBRARY__) || defined (__EMX__)
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
# include <stdlib.h>
diff --git a/src/getopt.h b/src/getopt.h
index f06ff515..a293bfd7 100644
--- a/src/getopt.h
+++ b/src/getopt.h
@@ -96,7 +96,7 @@ struct option
#define optional_argument 2
#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+#if defined (__GNU_LIBRARY__) || defined (__EMX__)
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
--
2.50.1