Unverified Commit be8e0842 authored by Nikolas Klauser's avatar Nikolas Klauser Committed by GitHub
Browse files

[libc++] Remove libc++'s own ctype.h (#194615)

Our own `ctype.h` only `#undef`s macros which the C header might define.
None of the libcs we support define any of these functions as macros, so
we can simply drop the header.
parent d38d8c62
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1009,7 +1009,6 @@ set(files
  cstring
  ctgmath
  ctime
  ctype.h
  cuchar
  cwchar
  cwctype
+5 −63
Original line number Diff line number Diff line
@@ -36,13 +36,11 @@ int toupper(int c);

#include <__cxx03/__config>

#if __has_include(<ctype.h>)
#  include <ctype.h>

#ifndef _LIBCPP_CTYPE_H
#   error <cctype> tried including <ctype.h> but didn't find libc++'s <ctype.h> header. \
          This usually means that your header search paths are not configured properly.  \
          The header search paths should contain the C++ Standard Library headers before \
          any C Standard Library.
#  ifdef _LIBCPP_CTYPE_H
#    error "If libc++ starts defining <ctype.h>, the __has_include check should move to libc++'s <ctype.h>"
#  endif
#endif

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -51,62 +49,6 @@ int toupper(int c);

_LIBCPP_BEGIN_NAMESPACE_STD

#ifdef isalnum
#  undef isalnum
#endif

#ifdef isalpha
#  undef isalpha
#endif

#ifdef isblank
#  undef isblank
#endif

#ifdef iscntrl
#  undef iscntrl
#endif

#ifdef isdigit
#  undef isdigit
#endif

#ifdef isgraph
#  undef isgraph
#endif

#ifdef islower
#  undef islower
#endif

#ifdef isprint
#  undef isprint
#endif

#ifdef ispunct
#  undef ispunct
#endif

#ifdef isspace
#  undef isspace
#endif

#ifdef isupper
#  undef isupper
#endif

#ifdef isxdigit
#  undef isxdigit
#endif

#ifdef tolower
#  undef tolower
#endif

#ifdef toupper
#  undef toupper
#endif

using ::isalnum _LIBCPP_USING_IF_EXISTS;
using ::isalpha _LIBCPP_USING_IF_EXISTS;
using ::isblank _LIBCPP_USING_IF_EXISTS;
+5 −63
Original line number Diff line number Diff line
@@ -39,13 +39,11 @@ int toupper(int c);
#else
#  include <__config>

#  if __has_include(<ctype.h>)
#    include <ctype.h>

#  ifndef _LIBCPP_CTYPE_H
#   error <cctype> tried including <ctype.h> but didn't find libc++'s <ctype.h> header. \
          This usually means that your header search paths are not configured properly.  \
          The header search paths should contain the C++ Standard Library headers before \
          any C Standard Library.
#    ifdef _LIBCPP_CTYPE_H
#      error "If libc++ starts defining <ctype.h>, the __has_include check should move to libc++'s <ctype.h>"
#    endif
#  endif

#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -54,62 +52,6 @@ int toupper(int c);

_LIBCPP_BEGIN_NAMESPACE_STD

#  ifdef isalnum
#    undef isalnum
#  endif

#  ifdef isalpha
#    undef isalpha
#  endif

#  ifdef isblank
#    undef isblank
#  endif

#  ifdef iscntrl
#    undef iscntrl
#  endif

#  ifdef isdigit
#    undef isdigit
#  endif

#  ifdef isgraph
#    undef isgraph
#  endif

#  ifdef islower
#    undef islower
#  endif

#  ifdef isprint
#    undef isprint
#  endif

#  ifdef ispunct
#    undef ispunct
#  endif

#  ifdef isspace
#    undef isspace
#  endif

#  ifdef isupper
#    undef isupper
#  endif

#  ifdef isxdigit
#    undef isxdigit
#  endif

#  ifdef tolower
#    undef tolower
#  endif

#  ifdef toupper
#    undef toupper
#  endif

using ::isalnum _LIBCPP_USING_IF_EXISTS;
using ::isalpha _LIBCPP_USING_IF_EXISTS;
using ::isblank _LIBCPP_USING_IF_EXISTS;

libcxx/include/ctype.h

deleted100644 → 0
+0 −65
Original line number Diff line number Diff line
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_CTYPE_H
#define _LIBCPP_CTYPE_H

/*
    ctype.h synopsis

int isalnum(int c);
int isalpha(int c);
int isblank(int c);  // C99
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int tolower(int c);
int toupper(int c);
*/

#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
#  include <__cxx03/__config>
#else
#  include <__config>
#endif

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#  pragma GCC system_header
#endif

#if __has_include_next(<ctype.h>)
#  include_next <ctype.h>
#endif

#ifdef __cplusplus

#  undef isalnum
#  undef isalpha
#  undef isblank
#  undef iscntrl
#  undef isdigit
#  undef isgraph
#  undef islower
#  undef isprint
#  undef ispunct
#  undef isspace
#  undef isupper
#  undef isxdigit
#  undef tolower
#  undef toupper

#endif

#endif // _LIBCPP_CTYPE_H
+0 −4
Original line number Diff line number Diff line
@@ -2445,10 +2445,6 @@ module std_complex_h [system] {
  header "complex.h"
  export *
}
module std_ctype_h [system] {
  header "ctype.h"
  export *
}
module std_errno_h [system] {
  header "errno.h"
  export *