4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-21 00:07:36 +08:00

change _COMPILING_NEWLIB to _LIBC

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.
This commit is contained in:
Mike Frysinger 2021-11-08 22:22:27 -05:00
parent 2b28977149
commit 6226bad0ea
35 changed files with 44 additions and 44 deletions

View File

@ -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=

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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 *);

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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 );

View File

@ -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

View File

@ -22,7 +22,7 @@ struct tms {
};
clock_t times (struct tms *);
#ifdef _COMPILING_NEWLIB
#ifdef _LIBC
clock_t _times (struct tms *);
#endif

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -10,7 +10,7 @@ details. */
#include <stdlib.h>
#include <unistd.h>
#define _COMPILING_NEWLIB
#define _LIBC
#include <dirent.h>
#include "cygerrno.h"

View File

@ -17,7 +17,7 @@ details. */
#include "cygheap.h"
#include "shared_info.h"
#define _COMPILING_NEWLIB
#define _LIBC
#include <dirent.h>
fhandler_cygdrive::fhandler_cygdrive () :

View File

@ -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"))

View File

@ -27,7 +27,7 @@ details. */
#include <aio.h>
#include <cygwin/fs.h>
#define _COMPILING_NEWLIB
#define _LIBC
#include <dirent.h>
enum __DIR_mount_type {

View File

@ -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 *&);

View File

@ -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 *&);

View File

@ -26,7 +26,7 @@ details. */
#include <sys/param.h>
#include <ctype.h>
#define _COMPILING_NEWLIB
#define _LIBC
#include <dirent.h>
#define _KERNEL

View File

@ -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,

View File

@ -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

View File

@ -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
{

View File

@ -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

View File

@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#ifdef _COMPILING_NEWLIB
#ifdef _LIBC
#include_next "getopt.h"
#else
#ifndef __GETOPT_H__

View File

@ -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;

View File

@ -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 '*' */

View File

@ -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."

View File

@ -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

View File

@ -44,7 +44,7 @@
#ifdef __CYGWIN__
/* Disable __IMPORT when defining __fdlib_version. */
#define _COMPILING_NEWLIB
#define _LIBC
#define _GNU_SOURCE
#endif
#include <math.h>