[1/6] Remove vestiges of external build support from libio headers.

Message ID 20180211163558.14124-2-zackw@panix.com
State New
Headers show
Series
  • Mostly mechanical libio decrufting.
Related show

Commit Message

Zack Weinberg Feb. 11, 2018, 4:35 p.m.
As requested by Adhemerval, this patch removes some preprocessor
conditionals from the libio headers that were only relevant when
building libio outside glibc.

	* libio/iolibio.h, libio/libioP.h: Remove extern "C".
        * libio/libio.h: Remove __BEGIN_DECLS and __END_DECLS.
	Remove preprocessor conditionals on _LIBC and __USE_GNU,
	which are always true, and __cplusplus, which is always false.

---
 libio/iolibio.h        |  8 --------
 libio/libio.h          | 32 +++++---------------------------
 libio/libioP.h         |  8 --------
 3 files changed, 5 insertions(+), 43 deletions(-)

Comments

Andreas Schwab Feb. 11, 2018, 5:45 p.m. | #1
On Feb 11 2018, Zack Weinberg <zackw@panix.com> wrote:

> 	* libio/iolibio.h, libio/libioP.h: Remove extern "C".
>         * libio/libio.h: Remove __BEGIN_DECLS and __END_DECLS.
> 	Remove preprocessor conditionals on _LIBC and __USE_GNU,
> 	which are always true, and __cplusplus, which is always false.

Ok.

Andreas.

Patch

diff --git a/libio/iolibio.h b/libio/iolibio.h
index 52731b65f91..4d43d0e72db 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -7,10 +7,6 @@ 
 /* These emulate stdio functionality, but with a different name
    (_IO_ungetc instead of ungetc), and using _IO_FILE instead of FILE. */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 extern int _IO_fclose (_IO_FILE*);
 extern int _IO_new_fclose (_IO_FILE*);
 extern int _IO_old_fclose (_IO_FILE*);
@@ -95,8 +91,4 @@  extern int __old_pclose (_IO_FILE *) __THROW;
 _IO_FILE *__new_freopen (const char *, const char *, _IO_FILE *) __THROW;
 _IO_FILE *__old_freopen (const char *, const char *, _IO_FILE *) __THROW;
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* iolibio.h.  */
diff --git a/libio/libio.h b/libio/libio.h
index 09531202472..7a68e1a3ae3 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -73,8 +73,6 @@  typedef union
 
 #include <shlib-compat.h>
 
-__BEGIN_DECLS
-
 /* compatibility defines */
 #define _STDIO_USES_IOSTREAM
 #define _IO_UNIFIED_JUMPTABLES 1
@@ -119,16 +117,12 @@  __BEGIN_DECLS
 
 #define _IO_FLAGS2_MMAP 1
 #define _IO_FLAGS2_NOTCANCEL 2
-#ifdef _LIBC
-# define _IO_FLAGS2_FORTIFY 4
-#endif
+#define _IO_FLAGS2_FORTIFY 4
 #define _IO_FLAGS2_USER_WBUF 8
-#ifdef _LIBC
-# define _IO_FLAGS2_SCANF_STD 16
-# define _IO_FLAGS2_NOCLOSE 32
-# define _IO_FLAGS2_CLOEXEC 64
-# define _IO_FLAGS2_NEED_LOCK 128
-#endif
+#define _IO_FLAGS2_SCANF_STD 16
+#define _IO_FLAGS2_NOCLOSE 32
+#define _IO_FLAGS2_CLOEXEC 64
+#define _IO_FLAGS2_NEED_LOCK 128
 
 /* These are "formatting flags" matching the iostream fmtflags enum values. */
 #define _IO_SKIPWS 01
@@ -227,29 +221,18 @@  struct _IO_wide_data
   const struct _IO_jump_t *_wide_vtable;
 };
 
-
-#ifndef __cplusplus
 typedef struct _IO_FILE _IO_FILE;
-#endif
 
 struct _IO_FILE_plus;
 
 extern struct _IO_FILE_plus _IO_2_1_stdin_;
 extern struct _IO_FILE_plus _IO_2_1_stdout_;
 extern struct _IO_FILE_plus _IO_2_1_stderr_;
-#ifndef _LIBC
-#define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
-#define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
-#define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_))
-#else
 extern _IO_FILE *_IO_stdin attribute_hidden;
 extern _IO_FILE *_IO_stdout attribute_hidden;
 extern _IO_FILE *_IO_stderr attribute_hidden;
-#endif
-
 
 /* Compatibility names for cookie I/O functions.  */
-#ifdef __USE_GNU
 typedef cookie_read_function_t __io_read_fn;
 typedef cookie_write_function_t __io_write_fn;
 typedef cookie_seek_function_t __io_seek_fn;
@@ -261,7 +244,6 @@  struct _IO_cookie_file;
 /* Initialize one of those.  */
 extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
 			     void *__cookie, _IO_cookie_io_functions_t __fns);
-#endif
 
 extern int __underflow (_IO_FILE *);
 extern _IO_wint_t __wunderflow (_IO_FILE *);
@@ -342,8 +324,6 @@  extern _IO_wint_t _IO_getwc (_IO_FILE *__fp);
 extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp);
 extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
 
-/* While compiling glibc we have to handle compatibility with very old
-   versions.  */
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
 #  define _IO_fwide_maybe_incompatible \
   (__builtin_expect (&_IO_stdin_used == NULL, 0))
@@ -416,6 +396,4 @@  libc_hidden_proto (_IO_vfscanf)
 # endif
 #endif /* _IO_MTSAFE_IO */
 
-__END_DECLS
-
 #endif /* _LIBIO_H */
diff --git a/libio/libioP.h b/libio/libioP.h
index 58cc9de094b..abbf3316855 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -52,10 +52,6 @@ 
    adjusts the libio configuration.  */
 #include <_G_config.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define _IO_seek_set 0
 #define _IO_seek_cur 1
 #define _IO_seek_end 2
@@ -731,10 +727,6 @@  extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
 # define _IO_pos_0 ((_IO_off64_t) 0)
 #endif
 
-#ifdef __cplusplus
-}
-#endif
-
 #ifdef _IO_MTSAFE_IO
 /* check following! */
 # ifdef _IO_USE_OLD_IO_FILE