Skip to content

Split internal.h into files #2711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Dec 26, 2019
Merged

Split internal.h into files #2711

merged 34 commits into from
Dec 26, 2019

Conversation

shyouhei
Copy link
Member

@shyouhei shyouhei commented Dec 2, 2019

Current internal.h is too large, too dirty. Let's house keep.

@shyouhei shyouhei force-pushed the internal.h branch 30 times, most recently from 8f88417 to 0a495e0 Compare December 6, 2019 02:14
Turn macros into inline functions for better readability.  Also add
rb_int128t2big delcaration, which was missing.
Marked MJIT_FUNC_EXPORTED functions as such.  Other changes are rather
cosmetic.
Reduce macros to make them inline functions, as well as mark
MJIT_FUNC_EXPORTED functions explicitly as such.

Definition of ar_hint_t is simplified.  This has been the only possible
definition so far.
Replace macros with inline functions of equivalent contents, for much
improved readability.
This file has almost nothing to do.  Added some #ifdef lines and
rearranged file contents.

Those macros are unable to translate into inline functions, because they
are used as lvalues of assignments.
Arrange contents and eliminate macros, to make them readable.

Macro IFUNC_NEW was deleted because there was only one usage.
Eliminated macros.  Also marked MJIT_FUNC_EXPORTED functions as such.
Some of them are declared in constant.h so edited that file also.
Rearrange contents for better readability, reduce macros for the same
reason, and mark MJIT_FUNC_EXPORTED functions as such.
This file containes other materials than in compile.c.  I could perhaps
split them into files, but felt overkill.  Just add comments that
describe the situations.
Reduce macros for readability.  Also transplanted some part of
internal/file.h into here because the delcared functions are in fact
defined in error.c.
Rearrange macro orders for better readability.
Improved readability by reducing the use of macros.  Also moved some
part of internal/compilers.h into this file, because it seems to be the
right place for them.
Eliminated macros.  As a side effect struct RBasicRaw is no longer
required because we can now define anonymous structs inside of inline
functions.
Annotated MJIT_FUNC_EXPORTED functions as such.  Declaration of
rb_sym_to_proc is moved into this file because the function is defined
in proc.c rather than string.c.
Eliminated the macro to convert into an inline function.
Eliminate macros for better readability.
Reduced the number of macros defined in the file.  Also made it explicit
for MJIT_FUNC_EXPORTTED functions to be so.
Some declatations are moved from internal/parse.h, to reflect the fact
that they are defined in symbol.c.
Rather trivial, added missed MJIT_FUNC_EXPORTED function declaration.
Rearranged contents, then added MJIT_FUNC_EXPORTED function
declarations.
These headers need no rewrite.  Just add some minor tweaks, like
addition of #include lines.  Mainly cosmetic.

TIMET_MAX_PLUS_ONE was deleted because the macro was used from only
one place (directly write expression there).
The same as 41bc766.  Read that commit
for what is happening.
Saves comitters' daily life by avoid #include-ing everything from
internal.h to make each file do so instead.  This would significantly
speed up incremental builds.

We take the following inclusion order in this changeset:

1.  "ruby/config.h", where _GNU_SOURCE is defined (must be the very
    first thing among everything).
2.  RUBY_EXTCONF_H if any.
3.  Standard C headers, sorted alphabetically.
4.  Other system headers, maybe guarded by #ifdef
5.  Everything else, sorted alphabetically.

Exceptions are those win32-related headers, which tend not be self-
containing (headers have inclusion order dependencies).
Noticed that internal/stdbool.h and addr2line.c are the only two place
where missing/stdbool.h is included.  Why not delete the file so that
we can merge internal/stdbool.h and missing/stdbool.h into one.
@shyouhei
Copy link
Member Author

I now think it's safe. I would like to merge this.

@shyouhei shyouhei merged commit 0c2d731 into ruby:master Dec 26, 2019
@shyouhei shyouhei deleted the internal.h branch December 26, 2019 11:45
@shyouhei shyouhei mentioned this pull request Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant