The Sufficiently Stupid C Compiler - a way to stop GCC trying to be smarter than you.
Koz Ross 0c9b281b10 Adding more safe opts | 7 سال پیش | |
---|---|---|
LICENSE | 7 سال پیش | |
README.md | 7 سال پیش | |
rscc | 7 سال پیش | |
sscc | 7 سال پیش |
sscc
is a wrapper around GCC designed to address its sufficient
smartness. For why sufficient smartness in a compiler is undesirable in
general, check out this rather good explanation.
Essentially, this disables every possible optimization in GCC through pedantic flag-setting, allowing you full control over what optimizations you do (and don't) want to turn on. You can use this wrapper, and then add whatever optimizations you want, and it'll work like you want (not like the authors of GCC reckon it should work).
Additionally, for those optimizations that are basically no-cost and
easy-to-follow, there is a script rscc
(reasonably smart C compiler), which
enables a few optimizations. Currently, these are:
-fdce -fdse
)-ffunction-cse
)-foptimize-sibling-calls
)Simply replace calls to gcc
with a call to sscc
or rscc
. Obviously,
if you pass any -O
arguments, the entire purpose of either script becomes
moot, so it's better not to. Otherwise, both take exactly the same arguments as
gcc
normally would. Both sscc
and rscc
are stand-alone shell scripts,
and can simply be included into your code's source tree. Just modify your build
system to use them instead of the system's GCC.
This has been tested on a Linux-based distro with GCC 7.1.1.
sscc
is licensed under the GPL, version 3 or later (SPDX code GPL-3.0+
).
For more details, see the LICENSE file.