[v2] change _COMPILING_NEWLIB to _LIBC

Message ID 20211113051256.25027-1-vapier@gentoo.org
State New
Headers show
Series
  • [v2] change _COMPILING_NEWLIB to _LIBC
Related show

Commit Message

Mike Frysinger Nov. 13, 2021, 5:12 a.m.
Use the same name as glibc & gnulib to indicate "newlib itself is
being compiled".  This also harmonizes the codebase a bit in that
_LIBC was already used in places instead of _COMPILING_NEWLIB.

Building for bfin-elf, mips-elf, and x86_64-pc-cygwin produces
the same object code.
---
v2
  - rebased

 newlib/configure.host                    |  2 +-
 newlib/libc/include/ctype.h              |  2 +-
 newlib/libc/include/dirent.h             |  2 +-
 newlib/libc/include/locale.h             |  2 +-
 newlib/libc/include/reent.h              |  2 +-
 newlib/libc/include/stdio.h              | 12 ++++++------
 newlib/libc/include/sys/_default_fcntl.h |  2 +-
 newlib/libc/include/sys/features.h       |  2 +-
 newlib/libc/include/sys/signal.h         |  4 ++--
 newlib/libc/include/sys/stat.h           |  4 ++--
 newlib/libc/include/sys/time.h           |  2 +-
 newlib/libc/include/sys/times.h          |  2 +-
 newlib/libc/include/sys/unistd.h         |  2 +-
 newlib/libc/include/sys/wait.h           |  2 +-
 newlib/libc/machine/cris/sys/fcntl.h     |  2 +-
 newlib/libc/machine/mips/memcpy.S        |  2 +-
 newlib/libc/machine/mips/memset.S        |  2 +-
 newlib/libc/machine/mips/strcmp.S        |  2 +-
 winsup/cygwin/dir.cc                     |  2 +-
 winsup/cygwin/fhandler_cygdrive.cc       |  2 +-
 winsup/cygwin/fhandler_dev.cc            |  2 +-
 winsup/cygwin/fhandler_disk_file.cc      |  2 +-
 winsup/cygwin/fhandler_proc.cc           |  2 +-
 winsup/cygwin/fhandler_process.cc        |  2 +-
 winsup/cygwin/fhandler_procsysvipc.cc    |  2 +-
 winsup/cygwin/fhandler_registry.cc       |  2 +-
 winsup/cygwin/include/cygwin/config.h    |  6 +++---
 winsup/cygwin/include/cygwin/stat.h      |  2 +-
 winsup/cygwin/include/cygwin/stdlib.h    |  2 +-
 winsup/cygwin/include/getopt.h           |  2 +-
 winsup/cygwin/include/machine/_types.h   |  2 +-
 winsup/cygwin/include/sys/dirent.h       |  2 +-
 winsup/cygwin/include/sys/syslimits.h    |  2 +-
 winsup/cygwin/include/sys/wait.h         |  2 +-
 winsup/cygwin/math/complex_internal.h    |  2 +-
 35 files changed, 44 insertions(+), 44 deletions(-)

-- 
2.33.0

Comments

Corinna Vinschen Nov. 15, 2021, 11:31 a.m. | #1
On Nov 13 00:12, Mike Frysinger wrote:
> Use the same name as glibc & gnulib to indicate "newlib itself is

> being compiled".  This also harmonizes the codebase a bit in that

> _LIBC was already used in places instead of _COMPILING_NEWLIB.

> 

> Building for bfin-elf, mips-elf, and x86_64-pc-cygwin produces

> the same object code.

> ---

> v2

>   - rebased

> 

>  newlib/configure.host                    |  2 +-

>  newlib/libc/include/ctype.h              |  2 +-

>  newlib/libc/include/dirent.h             |  2 +-

>  newlib/libc/include/locale.h             |  2 +-

>  newlib/libc/include/reent.h              |  2 +-

>  newlib/libc/include/stdio.h              | 12 ++++++------

>  newlib/libc/include/sys/_default_fcntl.h |  2 +-

>  newlib/libc/include/sys/features.h       |  2 +-

>  newlib/libc/include/sys/signal.h         |  4 ++--

>  newlib/libc/include/sys/stat.h           |  4 ++--

>  newlib/libc/include/sys/time.h           |  2 +-

>  newlib/libc/include/sys/times.h          |  2 +-

>  newlib/libc/include/sys/unistd.h         |  2 +-

>  newlib/libc/include/sys/wait.h           |  2 +-

>  newlib/libc/machine/cris/sys/fcntl.h     |  2 +-

>  newlib/libc/machine/mips/memcpy.S        |  2 +-

>  newlib/libc/machine/mips/memset.S        |  2 +-

>  newlib/libc/machine/mips/strcmp.S        |  2 +-

>  winsup/cygwin/dir.cc                     |  2 +-

>  winsup/cygwin/fhandler_cygdrive.cc       |  2 +-

>  winsup/cygwin/fhandler_dev.cc            |  2 +-

>  winsup/cygwin/fhandler_disk_file.cc      |  2 +-

>  winsup/cygwin/fhandler_proc.cc           |  2 +-

>  winsup/cygwin/fhandler_process.cc        |  2 +-

>  winsup/cygwin/fhandler_procsysvipc.cc    |  2 +-

>  winsup/cygwin/fhandler_registry.cc       |  2 +-

>  winsup/cygwin/include/cygwin/config.h    |  6 +++---

>  winsup/cygwin/include/cygwin/stat.h      |  2 +-

>  winsup/cygwin/include/cygwin/stdlib.h    |  2 +-

>  winsup/cygwin/include/getopt.h           |  2 +-

>  winsup/cygwin/include/machine/_types.h   |  2 +-

>  winsup/cygwin/include/sys/dirent.h       |  2 +-

>  winsup/cygwin/include/sys/syslimits.h    |  2 +-

>  winsup/cygwin/include/sys/wait.h         |  2 +-

>  winsup/cygwin/math/complex_internal.h    |  2 +-

>  35 files changed, 44 insertions(+), 44 deletions(-)


Looks good, please push.


Thanks,
Corinna

Patch

diff --git a/newlib/configure.host b/newlib/configure.host
index e737f73f5f75..c429dde1c3d1 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -54,7 +54,7 @@ 
 #   have_init_fini	have init/fini ("yes" or "no", set to "yes" by default)
 #   noinclude		list of include files to not install
 
-newlib_cflags="-D_COMPILING_NEWLIB"
+newlib_cflags="-D_LIBC"
 libm_machine_dir=
 machine_dir=
 shared_machine_dir=
diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h
index 366b35dc9f9d..65ab24bf03da 100644
--- a/newlib/libc/include/ctype.h
+++ b/newlib/libc/include/ctype.h
@@ -4,7 +4,7 @@ 
 #include "_ansi.h"
 #include <sys/cdefs.h>
 
-#if __POSIX_VISIBLE >= 200809 || __MISC_VISIBLE || defined (_COMPILING_NEWLIB)
+#if __POSIX_VISIBLE >= 200809 || __MISC_VISIBLE || defined (_LIBC)
 #include <sys/_locale.h>
 #endif
 
diff --git a/newlib/libc/include/dirent.h b/newlib/libc/include/dirent.h
index 5d566a81e2bc..cdfa21fa7835 100644
--- a/newlib/libc/include/dirent.h
+++ b/newlib/libc/include/dirent.h
@@ -64,7 +64,7 @@  int	 scandir(const char *, struct dirent ***,
 	    int (*)(const struct dirent *), int (*)(const struct dirent **,
 	    const struct dirent **));
 #endif
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 void	 _seekdir(DIR *, long);
 #endif
 #if __MISC_VISIBLE || __XSI_VISIBLE
diff --git a/newlib/libc/include/locale.h b/newlib/libc/include/locale.h
index 8abb8db922fb..ec7f86119c4e 100644
--- a/newlib/libc/include/locale.h
+++ b/newlib/libc/include/locale.h
@@ -21,7 +21,7 @@ 
 #define LC_TIME     5
 #define LC_MESSAGES 6
 
-#if __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB)
+#if __POSIX_VISIBLE >= 200809 || defined (_LIBC)
 
 #include <sys/_locale.h>
 
diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h
index 2b01fbe8f329..23d572cd3c51 100644
--- a/newlib/libc/include/reent.h
+++ b/newlib/libc/include/reent.h
@@ -174,7 +174,7 @@  extern int _open64_r (struct _reent *, const char *, int, int);
 extern int _stat64_r (struct _reent *, const char *, struct stat64 *);
 
 /* Don't pollute namespace if not building newlib. */
-#if defined (__CYGWIN__) && !defined (_COMPILING_NEWLIB)
+#if defined (__CYGWIN__) && !defined (_LIBC)
 #undef stat64
 #endif
 
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index ab18806e363f..7748351f09f8 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -222,13 +222,13 @@  int	puts (const char *);
 int	ungetc (int, FILE *);
 size_t	fread (void *__restrict, size_t _size, size_t _n, FILE *__restrict);
 size_t	fwrite (const void *__restrict , size_t _size, size_t _n, FILE *);
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 int	fgetpos (FILE *, _fpos_t *);
 #else
 int	fgetpos (FILE *__restrict, fpos_t *__restrict);
 #endif
 int	fseek (FILE *, long, int);
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 int	fsetpos (FILE *, const _fpos_t *);
 #else
 int	fsetpos (FILE *, const fpos_t *);
@@ -245,12 +245,12 @@  int	sprintf (char *__restrict, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
 int	remove (const char *);
 int	rename (const char *, const char *);
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 int	_rename (const char *, const char *);
 #endif
 #endif
 #if __LARGEFILE_VISIBLE || __POSIX_VISIBLE >= 200112
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 int	fseeko (FILE *, _off_t, int);
 _off_t	ftello (FILE *);
 #else
@@ -413,7 +413,7 @@  int	_fgetc_r (struct _reent *, FILE *);
 int	_fgetc_unlocked_r (struct _reent *, FILE *);
 char *  _fgets_r (struct _reent *, char *__restrict, int, FILE *__restrict);
 char *  _fgets_unlocked_r (struct _reent *, char *__restrict, int, FILE *__restrict);
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 int	_fgetpos_r (struct _reent *, FILE *__restrict, _fpos_t *__restrict);
 int	_fsetpos_r (struct _reent *, FILE *, const _fpos_t *);
 #else
@@ -549,7 +549,7 @@  int	fputs_unlocked (const char *__restrict, FILE *__restrict);
 #endif
 
 #ifdef __LARGE64_FILES
-#if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB)
+#if !defined(__CYGWIN__) || defined(_LIBC)
 FILE *	fdopen64 (int, const char *);
 FILE *  fopen64 (const char *, const char *);
 FILE *  freopen64 (const char *, const char *, FILE *);
diff --git a/newlib/libc/include/sys/_default_fcntl.h b/newlib/libc/include/sys/_default_fcntl.h
index 50a0de44bb29..48914c92eab4 100644
--- a/newlib/libc/include/sys/_default_fcntl.h
+++ b/newlib/libc/include/sys/_default_fcntl.h
@@ -226,7 +226,7 @@  extern int futimesat (int, const char *, const struct timeval [2]);
 
 /* Provide _<systemcall> prototypes for functions provided by some versions
    of newlib.  */
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 extern int _open (const char *, int, ...);
 extern int _fcntl (int, int, ...);
 #ifdef __LARGE64_FILES
diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
index 6b4999e83482..45476ce4ad50 100644
--- a/newlib/libc/include/sys/features.h
+++ b/newlib/libc/include/sys/features.h
@@ -321,7 +321,7 @@  extern "C" {
 
 #if _FORTIFY_SOURCE > 0 && !defined(__cplusplus) && !defined(__lint__) && \
    (__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1) && \
-   !defined(_COMPILING_NEWLIB)
+   !defined(_LIBC)
 #  if _FORTIFY_SOURCE > 1
 #    define __SSP_FORTIFY_LEVEL 2
 #  else
diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
index 4bd841b80fd2..8dc5fb9c34fc 100644
--- a/newlib/libc/include/sys/signal.h
+++ b/newlib/libc/include/sys/signal.h
@@ -169,9 +169,9 @@  int sigprocmask (int, const sigset_t *, sigset_t *);
 int pthread_sigmask (int, const sigset_t *, sigset_t *);
 #endif
 
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 int _kill (pid_t, int);
-#endif /* _COMPILING_NEWLIB */
+#endif /* _LIBC */
 
 #if __POSIX_VISIBLE
 int kill (pid_t, int);
diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h
index 3d31ba52f0a8..6525272dd401 100644
--- a/newlib/libc/include/sys/stat.h
+++ b/newlib/libc/include/sys/stat.h
@@ -20,7 +20,7 @@  extern "C" {
 
 #ifdef __CYGWIN__
 #include <cygwin/stat.h>
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 #define stat64 stat
 #endif
 #else
@@ -161,7 +161,7 @@  int	futimens (int, const struct timespec [2]);
 
 /* Provide prototypes for most of the _<systemcall> names that are
    provided in newlib for some compilers.  */
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 int	_fstat (int __fd, struct stat *__sbuf );
 int	_stat (const char *__restrict __path, struct stat *__restrict __sbuf );
 int	_mkdir (const char *_path, mode_t __mode );
diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h
index 3be6c1e4163e..5a3dec7ab308 100644
--- a/newlib/libc/include/sys/time.h
+++ b/newlib/libc/include/sys/time.h
@@ -436,7 +436,7 @@  int gettimeofday (struct timeval *__restrict __p,
 int futimesat (int, const char *, const struct timeval [2]);
 #endif
 
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 int _gettimeofday (struct timeval *__p, void *__tz);
 #endif
 
diff --git a/newlib/libc/include/sys/times.h b/newlib/libc/include/sys/times.h
index 05b254714675..25dc8bd05aab 100644
--- a/newlib/libc/include/sys/times.h
+++ b/newlib/libc/include/sys/times.h
@@ -22,7 +22,7 @@  struct tms {
 };
 
 clock_t times (struct tms *);
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 clock_t _times (struct tms *);
 #endif
 
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index 6aa5c5298997..3cc313080358 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -259,7 +259,7 @@  extern int optreset;			/* getopt(3) external variable */
 pid_t   vfork (void);
 #endif
 
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 /* Provide prototypes for most of the _<systemcall> names that are
    provided in newlib for some compilers.  */
 int     _close (int __fildes);
diff --git a/newlib/libc/include/sys/wait.h b/newlib/libc/include/sys/wait.h
index f17e53f125ac..d15eec9cb6fa 100644
--- a/newlib/libc/include/sys/wait.h
+++ b/newlib/libc/include/sys/wait.h
@@ -29,7 +29,7 @@  extern "C" {
 pid_t wait (int *);
 pid_t waitpid (pid_t, int *, int);
 
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 pid_t _wait (int *);
 #endif
 
diff --git a/newlib/libc/machine/cris/sys/fcntl.h b/newlib/libc/machine/cris/sys/fcntl.h
index 7630a98746e0..5ba8015b6cd9 100644
--- a/newlib/libc/machine/cris/sys/fcntl.h
+++ b/newlib/libc/machine/cris/sys/fcntl.h
@@ -149,7 +149,7 @@  extern int fcntl (int, int, ...);
 
 /* Provide _<systemcall> prototypes for functions provided by some versions
    of newlib.  */
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 extern int _open (const char *, int, ...);
 extern int _fcntl (int, int, ...);
 #ifdef __LARGE64_FILES
diff --git a/newlib/libc/machine/mips/memcpy.S b/newlib/libc/machine/mips/memcpy.S
index cbf06e367a28..471343fba5ff 100644
--- a/newlib/libc/machine/mips/memcpy.S
+++ b/newlib/libc/machine/mips/memcpy.S
@@ -33,7 +33,7 @@ 
 # define USE_MEMMOVE_FOR_OVERLAP
 # define PREFETCH_LOAD_HINT PREFETCH_HINT_LOAD_STREAMED
 # define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
-#elif _COMPILING_NEWLIB
+#elif _LIBC
 # include "machine/asm.h"
 # include "machine/regdef.h"
 # define PREFETCH_LOAD_HINT PREFETCH_HINT_LOAD_STREAMED
diff --git a/newlib/libc/machine/mips/memset.S b/newlib/libc/machine/mips/memset.S
index 3f1c8be0ead1..972c57bf260e 100644
--- a/newlib/libc/machine/mips/memset.S
+++ b/newlib/libc/machine/mips/memset.S
@@ -31,7 +31,7 @@ 
 # include "machine/asm.h"
 # include "machine/regdef.h"
 # define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
-#elif _COMPILING_NEWLIB
+#elif _LIBC
 # include "machine/asm.h"
 # include "machine/regdef.h"
 # define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
diff --git a/newlib/libc/machine/mips/strcmp.S b/newlib/libc/machine/mips/strcmp.S
index efc41614899d..9d33a4ee0d89 100644
--- a/newlib/libc/machine/mips/strcmp.S
+++ b/newlib/libc/machine/mips/strcmp.S
@@ -30,7 +30,7 @@ 
 #ifdef ANDROID_CHANGES
 # include "machine/asm.h"
 # include "machine/regdef.h"
-#elif _COMPILING_NEWLIB
+#elif _LIBC
 # include "machine/asm.h"
 # include "machine/regdef.h"
 #else
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index 7762557d6cf2..a181ce58c7ec 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -10,7 +10,7 @@  details. */
 #include <stdlib.h>
 #include <unistd.h>
 
-#define _COMPILING_NEWLIB
+#define _LIBC
 #include <dirent.h>
 
 #include "cygerrno.h"
diff --git a/winsup/cygwin/fhandler_cygdrive.cc b/winsup/cygwin/fhandler_cygdrive.cc
index 508cc3650538..91331aaad979 100644
--- a/winsup/cygwin/fhandler_cygdrive.cc
+++ b/winsup/cygwin/fhandler_cygdrive.cc
@@ -17,7 +17,7 @@  details. */
 #include "cygheap.h"
 #include "shared_info.h"
 
-#define _COMPILING_NEWLIB
+#define _LIBC
 #include <dirent.h>
 
 fhandler_cygdrive::fhandler_cygdrive () :
diff --git a/winsup/cygwin/fhandler_dev.cc b/winsup/cygwin/fhandler_dev.cc
index 5fd75a58e376..934cdf3581da 100644
--- a/winsup/cygwin/fhandler_dev.cc
+++ b/winsup/cygwin/fhandler_dev.cc
@@ -15,7 +15,7 @@  details. */
 #include "cygheap.h"
 #include "devices.h"
 
-#define _COMPILING_NEWLIB
+#define _LIBC
 #include <dirent.h>
 
 #define dev_prefix_len (sizeof ("/dev"))
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 33d88581951f..26726c5d7a0d 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -27,7 +27,7 @@  details. */
 #include <aio.h>
 #include <cygwin/fs.h>
 
-#define _COMPILING_NEWLIB
+#define _LIBC
 #include <dirent.h>
 
 enum __DIR_mount_type {
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index c8074dd22343..6ec6f8bc47d9 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -32,7 +32,7 @@  details. */
 #include "mount.h"
 #include <math.h>
 
-#define _COMPILING_NEWLIB
+#define _LIBC
 #include <dirent.h>
 
 static off_t format_proc_loadavg (void *, char *&);
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 888604e3d2bc..270b27f58eb7 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -27,7 +27,7 @@  details. */
 #include <sys/param.h>
 #include <ctype.h>
 
-#define _COMPILING_NEWLIB
+#define _LIBC
 #include <dirent.h>
 
 static off_t format_process_maps (void *, char *&);
diff --git a/winsup/cygwin/fhandler_procsysvipc.cc b/winsup/cygwin/fhandler_procsysvipc.cc
index 516864388a89..c2c7e0f9912c 100644
--- a/winsup/cygwin/fhandler_procsysvipc.cc
+++ b/winsup/cygwin/fhandler_procsysvipc.cc
@@ -26,7 +26,7 @@  details. */
 #include <sys/param.h>
 #include <ctype.h>
 
-#define _COMPILING_NEWLIB
+#define _LIBC
 #include <dirent.h>
 
 #define _KERNEL
diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc
index 5696a4904d43..747b76de30ad 100644
--- a/winsup/cygwin/fhandler_registry.cc
+++ b/winsup/cygwin/fhandler_registry.cc
@@ -18,7 +18,7 @@  details. */
 #include "cygheap.h"
 #include "child_info.h"
 
-#define _COMPILING_NEWLIB
+#define _LIBC
 #include <dirent.h>
 
 /* If this bit is set in __d_position then we are enumerating values,
diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h
index 282637b67130..71a216fbd16d 100644
--- a/winsup/cygwin/include/cygwin/config.h
+++ b/winsup/cygwin/include/cygwin/config.h
@@ -35,7 +35,7 @@  extern "C" {
    compute these offsets already exists for the sake of gendef so
    we might as well just use it here.  */
 
-#if defined (_COMPILING_NEWLIB) || defined (__INSIDE_CYGWIN__)
+#if defined (_LIBC) || defined (__INSIDE_CYGWIN__)
 #ifdef __x86_64__
 #include "../tlsoffsets64.h"
 #else
@@ -52,7 +52,7 @@  extern inline struct _reent *__getreent (void)
 #endif
   return (struct _reent *) (ret + tls_local_clib);
 }
-#endif /* _COMPILING_NEWLIB || __INSIDE_CYGWIN__ */
+#endif /* _LIBC || __INSIDE_CYGWIN__ */
 
 #ifdef __x86_64__
 # define __SYMBOL_PREFIX
@@ -81,7 +81,7 @@  extern inline struct _reent *__getreent (void)
 #define __TM_ZONE   tm_zone
 #define _USE_LONG_TIME_T 1
 
-#if defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB)
+#if defined(__INSIDE_CYGWIN__) || defined(_LIBC)
 #define __EXPORT __declspec(dllexport)
 #define __IMPORT
 #else
diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h
index 0e489d7a981e..1530529105d8 100644
--- a/winsup/cygwin/include/cygwin/stat.h
+++ b/winsup/cygwin/include/cygwin/stat.h
@@ -32,7 +32,7 @@  struct stat
   timestruc_t   st_birthtim;
 };
 
-#if defined (__INSIDE_CYGWIN__) || defined (_COMPILING_NEWLIB)
+#if defined (__INSIDE_CYGWIN__) || defined (_LIBC)
 #ifdef __i386__
 struct __stat32
 {
diff --git a/winsup/cygwin/include/cygwin/stdlib.h b/winsup/cygwin/include/cygwin/stdlib.h
index e274b8b9465f..dd1077b51d2b 100644
--- a/winsup/cygwin/include/cygwin/stdlib.h
+++ b/winsup/cygwin/include/cygwin/stdlib.h
@@ -43,7 +43,7 @@  int getpt (void);
 int posix_openpt (int);
 #endif
 
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 #define unsetenv UNUSED_unsetenv
 #define _unsetenv_r UNUSED__unsetenv_r
 #endif
diff --git a/winsup/cygwin/include/getopt.h b/winsup/cygwin/include/getopt.h
index 19c347b91594..c5af1acd469f 100644
--- a/winsup/cygwin/include/getopt.h
+++ b/winsup/cygwin/include/getopt.h
@@ -27,7 +27,7 @@ 
  * SUCH DAMAGE.
  */
 
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 #include_next "getopt.h"
 #else
 #ifndef __GETOPT_H__
diff --git a/winsup/cygwin/include/machine/_types.h b/winsup/cygwin/include/machine/_types.h
index 7e636f8f833a..d84890f401ba 100644
--- a/winsup/cygwin/include/machine/_types.h
+++ b/winsup/cygwin/include/machine/_types.h
@@ -5,7 +5,7 @@ 
 
 #include <machine/_default_types.h>
 
-#if defined (__INSIDE_CYGWIN__) || defined (_COMPILING_NEWLIB)
+#if defined (__INSIDE_CYGWIN__) || defined (_LIBC)
 typedef __int32_t __blkcnt32_t;
 typedef __int16_t  __dev16_t;
 typedef __uint16_t __uid16_t;
diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys/dirent.h
index 177a553b2a73..0e7a78cc08bd 100644
--- a/winsup/cygwin/include/sys/dirent.h
+++ b/winsup/cygwin/include/sys/dirent.h
@@ -45,7 +45,7 @@  struct dirent
 #endif
 typedef struct __DIR
 {
-  /* This is first to set alignment in non _COMPILING_NEWLIB case.  */
+  /* This is first to set alignment in non _LIBC case.  */
   unsigned long __d_cookie;
   struct dirent *__d_dirent;
   char *__d_dirname;			/* directory name with trailing '*' */
diff --git a/winsup/cygwin/include/sys/syslimits.h b/winsup/cygwin/include/sys/syslimits.h
index ff14e76cdf7f..5ebdc193804f 100644
--- a/winsup/cygwin/include/sys/syslimits.h
+++ b/winsup/cygwin/include/sys/syslimits.h
@@ -9,7 +9,7 @@  details. */
 #ifndef _SYS_SYSLIMITS_H
 #define _SYS_SYSLIMITS_H
 
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 # include <limits.h>
 #else
 # error "Do not include sys/syslimits.h from applications directly."
diff --git a/winsup/cygwin/include/sys/wait.h b/winsup/cygwin/include/sys/wait.h
index 1ed1f5a2e801..26ec28b6d7cf 100644
--- a/winsup/cygwin/include/sys/wait.h
+++ b/winsup/cygwin/include/sys/wait.h
@@ -22,7 +22,7 @@  pid_t waitpid (pid_t __pid, int *__status, int __options);
 pid_t wait3 (int *__status, int __options, struct rusage *__rusage);
 pid_t wait4 (pid_t __pid, int *__status, int __options, struct rusage *__rusage);
 
-#ifdef _COMPILING_NEWLIB
+#ifdef _LIBC
 pid_t _wait (int *);
 #endif
 
diff --git a/winsup/cygwin/math/complex_internal.h b/winsup/cygwin/math/complex_internal.h
index e54e61d71fbc..de1058783c9b 100644
--- a/winsup/cygwin/math/complex_internal.h
+++ b/winsup/cygwin/math/complex_internal.h
@@ -44,7 +44,7 @@ 
 
 #ifdef __CYGWIN__
 /* Disable __IMPORT when defining __fdlib_version. */
-#define _COMPILING_NEWLIB
+#define _LIBC
 #define _GNU_SOURCE
 #endif
 #include <math.h>