mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
reduce duplicate include.
Without this patch, 20k files are opened (openat syscall) because of duplicate includes. This patch reduced it to 3k and build time was reduced compile time of range.o from 15sec -> 3sec on my machine. [Bug #16772]
This commit is contained in:
parent
63a5412db7
commit
443389effc
Notes:
git
2020-04-10 14:53:50 +09:00
40 changed files with 9 additions and 56 deletions
|
@ -72,7 +72,6 @@
|
|||
#include "ruby/3/attr/weakref.h"
|
||||
#include "ruby/3/cast.h"
|
||||
#include "ruby/3/config.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/intern/class.h"
|
||||
#include "ruby/3/intern/vm.h"
|
||||
#include "ruby/3/method.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "ruby/3/dllexport.h"
|
||||
#include "ruby/3/special_consts.h"
|
||||
#include "ruby/3/value.h"
|
||||
#include "ruby/3/warning_push.h"
|
||||
#include "ruby/assert.h"
|
||||
|
||||
#define RB_INT2NUM rb_int2num_inline
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#define RUBY3_ASSUME_H
|
||||
#include "ruby/3/config.h"
|
||||
#include "ruby/3/cast.h"
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/builtin.h"
|
||||
|
||||
/** @cond INTERNAL_MACRO */
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_ALLOC_SIZE.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((alloc_size))` */
|
||||
#if defined(RUBY3_ATTR_ALLOC_SIZE)
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
* case it gets vital to know where the inlining happened in the callee.
|
||||
* See also https://stackoverflow.com/a/21936099
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((artificial))` */
|
||||
#if defined(RUBY3_ATTR_ARTIFICIAL)
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* @brief Defines #RUBY3_ATTR_COLD.
|
||||
*/
|
||||
#include "ruby/3/compiler_is.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((cold))` */
|
||||
#if defined(RUBY3_ATTR_COLD)
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_CONST.
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/has/declspec_attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((const))` */
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
#include "ruby/3/has/feature.h"
|
||||
#include "ruby/3/compiler_is.h"
|
||||
#include "ruby/3/token_paste.h"
|
||||
|
||||
/** @cond INTERNAL_MACRO*/
|
||||
#if defined(RUBY3_ATTR_CONSTEXPR)
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_DEPRECATED.
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/has/c_attribute.h"
|
||||
#include "ruby/3/has/cpp_attribute.h"
|
||||
#include "ruby/3/has/declspec_attribute.h"
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_DIAGNOSE_IF.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/warning_push.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((diagnose_if))` */
|
||||
#if defined(RUBY3_ATTR_DIAGNOSE_IF)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief #RUBY3_ATTR_ENUM_EXTENSIBILITY.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((enum_extensibility))` */
|
||||
#if defined(RUBY3_ATTR_ENUM_EXTENSIBILITY)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_ERROR.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((error))` */
|
||||
#if defined(RUBY3_ATTR_ERROR)
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* @brief Defines #RUBY3_ATTR_FLAG_ENUM.
|
||||
* @see https://clang.llvm.org/docs/AttributeReference.html#flag_enum
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((flag_enum)` */
|
||||
#if defined(RUBY3_ATTR_FLAG_ENUM)
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_FORCEINLINE.
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/**
|
||||
* Wraps (or simulates) `__forceinline`. MSVC complains on declarations like
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_FORMAT.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((format))` */
|
||||
#if defined(RUBY3_ATTR_FORMAT)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_MAYBE_UNUSED.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/has/c_attribute.h"
|
||||
#include "ruby/3/has/cpp_attribute.h"
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_NODISCARD.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/has/c_attribute.h"
|
||||
#include "ruby/3/has/cpp_attribute.h"
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
* Itanium C++ ABI has zero-cost exception handling), but does impact on
|
||||
* generated binary size. This is bad.
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/feature.h"
|
||||
|
||||
/** Wraps (or simulates) C++11 `noexcept` */
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_NOINLINE.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/has/declspec_attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__declspec(noinline)` */
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_NONNULL.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((nonnull))` */
|
||||
#if defined(RUBY3_ATTR_NONNULL)
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_NORETURN.
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/has/cpp_attribute.h"
|
||||
#include "ruby/3/has/declspec_attribute.h"
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_PURE.
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/assert.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((pure))` */
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_RESTRICT.
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/token_paste.h"
|
||||
|
||||
/* :FIXME: config.h includes conflicting `#define restrict`. MSVC can be
|
||||
* detected using `RUBY3_COMPILER_SINCE()`, but Clang & family cannot use
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_RETURNS_NONNULL.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((returns_nonnull))` */
|
||||
#if defined(RUBY3_ATTR_RETURNS_NONNULL)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_WARNING.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((warning))` */
|
||||
#if defined(RUBY3_ATTR_WARNING)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_ATTR_WEAKREF.
|
||||
*/
|
||||
#include "ruby/3/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((weakref))` */
|
||||
#if defined(RUBY3_ATTR_WEAKREF)
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
* public headers. They could be used from C++, and C-style casts could issue
|
||||
* warnings. Ruby internals are pure C so they should not bother.
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/warning.h"
|
||||
#include "ruby/3/warning_push.h"
|
||||
|
||||
#if defined(RUBY3_CAST)
|
||||
# /* Take that. */
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
* @retval true It is.
|
||||
* @retval false It isn't.
|
||||
*/
|
||||
#ifndef RUBY3_COMPILER_IS_INCLUDED
|
||||
#define RUBY3_COMPILER_IS_INCLUDED
|
||||
|
||||
#ifndef RUBY3_COMPILER_IS
|
||||
# define RUBY3_COMPILER_IS(cc) RUBY3_COMPILER_IS_ ## cc
|
||||
#endif
|
||||
|
@ -41,3 +44,5 @@
|
|||
* Apple's might be needed.
|
||||
*
|
||||
* - ARM's armclang: ditto, it can be clang-backended. */
|
||||
|
||||
#endif // RUBY3_COMPILER_IS_INCLUDED
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
#endif
|
||||
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/warning.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/warning_push.h"
|
||||
#include "ruby/3/token_paste.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#/* __builtin_choose_expr and __builtin_types_compatible aren't available
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "ruby/3/core/rbasic.h"
|
||||
#include "ruby/3/dllexport.h"
|
||||
#include "ruby/3/fl_type.h"
|
||||
#include "ruby/3/token_paste.h"
|
||||
#include "ruby/3/value.h"
|
||||
#include "ruby/3/value_type.h"
|
||||
#include "ruby/defines.h"
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
* @brief Defines #RUBY3_HAS_ATTRIBUTE.
|
||||
*/
|
||||
#include "ruby/3/config.h"
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/token_paste.h"
|
||||
|
||||
/** Wraps (or simulates) `__has_attribute`. */
|
||||
#if defined(RUBY3_HAS_ATTRIBUTE)
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
* @brief Defines #RUBY3_HAS_BUILTIN.
|
||||
*/
|
||||
#include "ruby/3/config.h"
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/token_paste.h"
|
||||
|
||||
/** Wraps (or simulates) `__has_builtin`. */
|
||||
#if defined(RUBY3_HAS_BUILTIN)
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
* @brief Defines #RUBY3_HAS_CPP_ATTRIBUTE.
|
||||
*/
|
||||
#include "ruby/3/compiler_is.h"
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/token_paste.h"
|
||||
|
||||
/** @cond INTERNAL_MACRO */
|
||||
#if defined(RUBY3_HAS_CPP_ATTRIBUTE0)
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RUBY3_HAS_DECLSPEC_ATTRIBUTE.
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/token_paste.h"
|
||||
|
||||
/** Wraps (or simulates) `__has_declspec_attribute`. */
|
||||
#if defined(RUBY3_HAS_DECLSPEC_ATTRIBUTE)
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
#include <assert.h>
|
||||
#include "ruby/3/has/extension.h"
|
||||
#include "ruby/3/compiler_since.h"
|
||||
|
||||
/** @cond INTERNAL_MACRO */
|
||||
#if defined(RUBY3_STATIC_ASSERT0)
|
||||
|
|
|
@ -25,10 +25,8 @@
|
|||
#endif
|
||||
|
||||
#include "ruby/3/compiler_is.h"
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/feature.h"
|
||||
#include "ruby/3/has/extension.h"
|
||||
#include "ruby/3/has/attribute.h"
|
||||
#include "ruby/3/has/declspec_attribute.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
* @brief Defines #RUBY3_TOKEN_PASTE.
|
||||
*/
|
||||
#include "ruby/3/config.h"
|
||||
#include "ruby/3/compiler_since.h"
|
||||
#include "ruby/3/has/warning.h"
|
||||
#include "ruby/3/warning_push.h"
|
||||
|
||||
/* :TODO: add your compiler here. There are many compilers that can suppress
|
||||
* warnings via pragmas, but not all of them accept such things inside of `#if`
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* ```
|
||||
*/
|
||||
#include "ruby/3/compiler_is.h"
|
||||
#include "ruby/3/compiler_since.h"
|
||||
|
||||
#ifdef RUBY3_WARNING_PUSH
|
||||
# /* Take that. */
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines old #GCC_VERSION_SINCE
|
||||
*/
|
||||
#include "ruby/3/compiler_since.h"
|
||||
|
||||
#ifndef GCC_VERSION_SINCE
|
||||
#define GCC_VERSION_SINCE(x, y, z) RUBY3_COMPILER_SINCE(GCC, (x), (y), (z))
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
* compatibility only.
|
||||
*/
|
||||
#include "ruby/3/config.h"
|
||||
#include "ruby/3/has/warning.h"
|
||||
#include "ruby/3/warning_push.h"
|
||||
|
||||
#if defined(LONG_LONG)
|
||||
# /* Take that. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue