1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-04-23 16:43:24 -07:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Connor Olding 7582a84356 enable more optimizations in release flags 2019-07-27 08:02:19 -07:00
Connor Olding d100b43f69 fix bugs in noccom 2019-07-27 08:01:48 -07:00
2 changed files with 37 additions and 5 deletions

View File

@ -160,7 +160,7 @@ compile() {
our_flags+=(-march=native)
fi
local debug_flags=(-O1 -g -D_DEBUG);
local release_flags=(-Ofast -mtune=native -g0 -fomit-frame-pointer -s -DNDEBUG)
local release_flags=(-Ofast -fwhole-program -fweb -mtune=native -g0 -fomit-frame-pointer -s -DNDEBUG)
local dr_flags=(-Ofast -g -fomit-frame-pointer -DNDEBUG)
local hardened_flags=(-O3 -g0 -s
-DNDEBUG -D_FORTIFY_SOURCE=2

View File

@ -4,13 +4,45 @@
noccom() {
[ -s ~/opt/local/bin/noccom ] || cat > ~/opt/local/bin/noccom <<EOF
#!/usr/bin/env perl
$/ = undef;
\$/ = undef;
\$_ = <>;
s#/\\*[^*]*\\*+([^/*][^*]*\\*+)*/|//([^\\\\]|[^\\n][\\n]?)*?\\n|("(\\\\.|[^"\\\\])*"|'(\\\\.|[^'\\\\])*'|.[^/"'\\\\]*)#defined \$3 ? \$3 : ""#gse;
s#|\\\\?\\n\\s*([{}])?\\s*(;*)\\s*(?=\\\\?\\n)|("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|.[^/"'\\\\\\n]*)#defined \$3?\$3:defined \$1?" ".\$1.\$2:\$2#gse;
s#^(\\s*\\n)+##s;
s{
/\\*[^*]*\\*+([^/*][^*]*\\*+)*/
|
//([^\\\\]
|
[^\\n][\\n]?)*?\\n
|
(
"(?:\\\\.|[^"\\\\])*"
|
'(?:\\\\.|[^'\\\\])*'
|
.[^/"'\\\\]*
)
}{defined \$3 ? \$3 : ""}gxse;
s{
\\\\?\\n\\s*([{}])?\\s*(;*)\\s*(?=\\\\?\\n)
|
(
\\#[^\\n]*\\n
|
"(?:\\\\.|[^"\\\\])*"
|
'(?:\\\\.|[^'\\\\])*'
|
.[^#/"'\\\\\\n]*
)
}{defined \$3 ? \$3 : (defined \$1 ? " ".\$1.\$2 : \$2)}gxse;
s#(^|\\n)\\s+#\$1#gs;
print;
EOF
perl ~/opt/local/bin/noccom "$@"
}
noccom "$@"