-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Contest Management System - http://cms-dev.github.io/ | ||
# Copyright © 2024 Filippo Casarin <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"""C++20 programming language definition.""" | ||
|
||
from cms.grading import CompiledLanguage | ||
|
||
|
||
__all__ = ["Cpp20Gpp"] | ||
|
||
|
||
class Cpp20Gpp(CompiledLanguage): | ||
"""This defines the C++ programming language, compiled with g++ (the | ||
version available on the system) using the C++20 standard. | ||
""" | ||
|
||
@property | ||
def name(self): | ||
"""See Language.name.""" | ||
return "C++20 / g++" | ||
|
||
@property | ||
def source_extensions(self): | ||
"""See Language.source_extensions.""" | ||
return [".cpp", ".cc", ".cxx", ".c++", ".C"] | ||
|
||
@property | ||
def header_extensions(self): | ||
"""See Language.header_extensions.""" | ||
return [".h"] | ||
|
||
@property | ||
def object_extensions(self): | ||
"""See Language.object_extensions.""" | ||
return [".o"] | ||
|
||
def get_compilation_commands(self, | ||
source_filenames, executable_filename, | ||
for_evaluation=True): | ||
"""See Language.get_compilation_commands.""" | ||
command = ["/usr/bin/g++"] | ||
if for_evaluation: | ||
command += ["-DEVAL"] | ||
command += ["-std=gnu++20", "-O2", "-pipe", "-static", | ||
"-s", "-o", executable_filename] | ||
command += source_filenames | ||
return [command] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <iostream> | ||
|
||
static_assert(__cplusplus == 202002L, "C++20 expected"); | ||
|
||
int main() { | ||
int n; | ||
std::cin >> n; | ||
std::cout << "correct " << n << std::endl; | ||
} |
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