Last active
October 2, 2020 15:35
-
-
Save moesoha/17619a6d92f22a9a0b0fccd74eadb650 to your computer and use it in GitHub Desktop.
Luogu customized GCC diff. https://www.luogu.com.cn/discuss/show/259685
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/gcc/c-family/c-attribs.c | |
+++ b/src/gcc/c-family/c-attribs.c | |
@@ -4894,6 +4894,11 @@ | |
handle_optimize_attribute (tree *node, tree name, tree args, | |
int ARG_UNUSED (flags), bool *no_add_attrs) | |
{ | |
+ if (getenv("ONLINE_JUDGE")) | |
+ { | |
+ error_at (DECL_SOURCE_LOCATION (*node), "%qE attribute is disallowed in online judge mode", name); | |
+ return NULL_TREE; | |
+ } | |
/* Ensure we have a function type. */ | |
if (TREE_CODE (*node) != FUNCTION_DECL) | |
{ | |
--- a/src/gcc/c-family/c-pragma.c | |
+++ b/src/gcc/c-family/c-pragma.c | |
@@ -862,6 +862,11 @@ | |
tree x; | |
bool close_paren_needed_p = false; | |
+ if (getenv("ONLINE_JUDGE")) | |
+ { | |
+ error ("%<#pragma GCC option%> is not allowed in online judge mode"); | |
+ return; | |
+ } | |
if (cfun) | |
{ | |
error ("%<#pragma GCC option%> is not allowed inside functions"); | |
@@ -931,6 +936,11 @@ | |
bool close_paren_needed_p = false; | |
tree optimization_previous_node = optimization_current_node; | |
+ if (getenv("ONLINE_JUDGE")) | |
+ { | |
+ error ("%<#pragma GCC optimize%> is not allowed in online judge mode"); | |
+ return; | |
+ } | |
if (cfun) | |
{ | |
error ("%<#pragma GCC optimize%> is not allowed inside functions"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/gcc/c-family/c-attribs.c | |
+++ b/src/gcc/c-family/c-attribs.c | |
@@ -4894,6 +4894,11 @@ | |
handle_optimize_attribute (tree *node, tree name, tree args, | |
int ARG_UNUSED (flags), bool *no_add_attrs) | |
{ | |
+ if (getenv("ONLINE_JUDGE")) | |
+ { | |
+ error_at (DECL_SOURCE_LOCATION (*node), "%qE attribute is disallowed in online judge mode", name); | |
+ return NULL_TREE; | |
+ } | |
/* Ensure we have a function type. */ | |
if (TREE_CODE (*node) != FUNCTION_DECL) | |
{ | |
--- a/src/gcc/c-family/c-pragma.c | |
+++ b/src/gcc/c-family/c-pragma.c | |
@@ -931,6 +936,11 @@ | |
bool close_paren_needed_p = false; | |
tree optimization_previous_node = optimization_current_node; | |
+ if (getenv("ONLINE_JUDGE")) | |
+ { | |
+ error ("%<#pragma GCC optimize%> is not allowed in online judge mode"); | |
+ return; | |
+ } | |
if (cfun) | |
{ | |
error ("%<#pragma GCC optimize%> is not allowed inside functions"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/gcc/c-family/c-pragma.c | |
+++ b/src/gcc/c-family/c-pragma.c | |
@@ -862,6 +862,11 @@ | |
tree x; | |
bool close_paren_needed_p = false; | |
+ if (getenv("ONLINE_JUDGE")) | |
+ { | |
+ error ("%<#pragma GCC option%> is not allowed in online judge mode"); | |
+ return; | |
+ } | |
if (cfun) | |
{ | |
error ("%<#pragma GCC option%> is not allowed inside functions"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment