diff options
author | Daniel Moody <dmoody256@gmail.com> | 2023-01-23 22:28:24 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-01-23 23:50:18 +0000 |
commit | 4ecc81d9cc5f56887be827ab2793d0f7114e816f (patch) | |
tree | 22eac6df1178ef36c6360d940871b4a75070dccd | |
parent | 291b5e82c87e689a33ff1168c59b89502a37be3c (diff) | |
download | mongo-4ecc81d9cc5f56887be827ab2793d0f7114e816f.tar.gz |
SERVER-73047 add mongo tidy check unittests
-rw-r--r-- | buildscripts/linter/simplecpplint.py | 8 | ||||
-rw-r--r-- | etc/evergreen_yml_components/definitions.yml | 2 | ||||
-rw-r--r-- | site_scons/site_tools/compilation_db.py | 18 | ||||
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp | 54 | ||||
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/MongoTestCheck.h | 56 | ||||
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/MongoTidyModule.cpp | 57 | ||||
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/SConscript | 17 | ||||
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheckTestMain.cpp | 32 | ||||
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheck_unittest.py | 122 | ||||
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/tests/SConscript | 61 | ||||
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/tests/test_MongoTestCheck.cpp | 32 |
11 files changed, 409 insertions, 50 deletions
diff --git a/buildscripts/linter/simplecpplint.py b/buildscripts/linter/simplecpplint.py index e3c3685a6c1..f668c9e638f 100644 --- a/buildscripts/linter/simplecpplint.py +++ b/buildscripts/linter/simplecpplint.py @@ -404,6 +404,13 @@ class Linter: if "enterprise" in self.file_name: return + norm_file_name = self.file_name.replace('\\', '/') + + # Custom clang-tidy check tests purposefully produce errors for + # tests to find, they should be ignored. + if "mongo_tidy_checks/tests/" in norm_file_name: + return + # The following files are in the src/mongo/ directory but technically belong # in src/third_party/ because their copyright does not belong to MongoDB. files_to_ignore = set([ @@ -419,7 +426,6 @@ class Linter: 'src/mongo/util/scopeguard.h', ]) - norm_file_name = self.file_name.replace('\\', '/') for file_to_ignore in files_to_ignore: if file_to_ignore in norm_file_name: return diff --git a/etc/evergreen_yml_components/definitions.yml b/etc/evergreen_yml_components/definitions.yml index 01f382c3583..b80a4d69b0e 100644 --- a/etc/evergreen_yml_components/definitions.yml +++ b/etc/evergreen_yml_components/definitions.yml @@ -2764,7 +2764,7 @@ tasks: vars: task_compile_flags: >- --build-profile=compiledb - targets: compiledb + targets: compiledb +mongo-tidy-tests compiling_for_test: true compile_flags: >- --link-model=dynamic diff --git a/site_scons/site_tools/compilation_db.py b/site_scons/site_tools/compilation_db.py index 7e26b91d258..8bcf2398ce4 100644 --- a/site_scons/site_tools/compilation_db.py +++ b/site_scons/site_tools/compilation_db.py @@ -36,7 +36,7 @@ import itertools # compilation database can access the complete list, and also so that the writer has easy # access to write all of the files. But it seems clunky. How can the emitter and the scanner # communicate more gracefully? -__COMPILATION_DB_ENTRIES = [] +__COMPILATION_DB_ENTRIES = {} # Cribbed from Tool/cc.py and Tool/c++.py. It would be better if # we could obtain this from SCons. @@ -100,7 +100,12 @@ def makeEmitCompilationDbEntry(comstr): env.AlwaysBuild(entry) env.NoCache(entry) - __COMPILATION_DB_ENTRIES.append(dbtarget) + compiledb_target = env.get('COMPILEDB_TARGET') + + if compiledb_target not in __COMPILATION_DB_ENTRIES: + __COMPILATION_DB_ENTRIES[compiledb_target] = [] + + __COMPILATION_DB_ENTRIES[compiledb_target].append(dbtarget) return target, source @@ -137,7 +142,7 @@ def CompilationDbEntryAction(target, source, env, **kw): def WriteCompilationDb(target, source, env): entries = [] - for s in __COMPILATION_DB_ENTRIES: + for s in __COMPILATION_DB_ENTRIES[target[0].abspath]: entries.append(s.read()) with open(str(target[0]), "w") as target_file: @@ -151,7 +156,10 @@ def WriteCompilationDb(target, source, env): def ScanCompilationDb(node, env, path): - return __COMPILATION_DB_ENTRIES + all_entries = [] + for compiledb_target in __COMPILATION_DB_ENTRIES: + all_entries.extend(__COMPILATION_DB_ENTRIES[compiledb_target]) + return all_entries def generate(env, **kwargs): @@ -203,7 +211,9 @@ def generate(env, **kwargs): ) def CompilationDatabase(env, target): + result = env.__COMPILATIONDB_Database(target=target, source=[]) + env['COMPILEDB_TARGET'] = result[0].abspath env.AlwaysBuild(result) env.NoCache(result) diff --git a/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp b/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp index eaccb77af78..72cbbc89872 100644 --- a/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp +++ b/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp @@ -26,11 +26,10 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ +#include "MongoTestCheck.h" #include "clang-tidy/ClangTidy.h" #include "clang-tidy/ClangTidyCheck.h" -#include "clang-tidy/ClangTidyModule.h" -#include "clang-tidy/ClangTidyModuleRegistry.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" @@ -42,44 +41,21 @@ using namespace clang::ast_matchers; // This is a dummy reference check to give example for writing new checks. // This check should be removed (the file here and any references to it) once we have // some real checks. -namespace { -class MongoDummyCheck : public ClangTidyCheck { +namespace mongo { +namespace tidy { -public: - MongoDummyCheck(StringRef Name, ClangTidyContext* Context) : ClangTidyCheck(Name, Context) {} +MongoTestCheck::MongoTestCheck(StringRef Name, ClangTidyContext* Context) + : ClangTidyCheck(Name, Context) {} - void registerMatchers(ast_matchers::MatchFinder* Finder) override { - Finder->addMatcher(translationUnitDecl().bind("tu"), this); - } +void MongoTestCheck::registerMatchers(ast_matchers::MatchFinder* Finder) { + Finder->addMatcher(translationUnitDecl().bind("tu"), this); +} - void check(const ast_matchers::MatchFinder::MatchResult& Result) override { - auto S = Result.Nodes.getNodeAs<TranslationUnitDecl>("tu"); - if (S) - diag("mytest success"); - } +void MongoTestCheck::check(const ast_matchers::MatchFinder::MatchResult& Result) { + auto S = Result.Nodes.getNodeAs<TranslationUnitDecl>("tu"); + if (S) + diag("ran mongo-test-check!"); +} -private: -}; - -class CTTestModule : public ClangTidyModule { -public: - void addCheckFactories(ClangTidyCheckFactories& CheckFactories) override { - CheckFactories.registerCheck<MongoDummyCheck>("mongo-test-check"); - } -}; -} // namespace - -namespace tidy1 { -// Register the CTTestTidyModule using this statically initialized variable. -static ClangTidyModuleRegistry::Add<::CTTestModule> X("mytest-module", "Adds my checks."); -} // namespace tidy1 - -namespace tidy2 { -// intentionally collide with an existing test group name, merging with it -static ClangTidyModuleRegistry::Add<::CTTestModule> X("misc-module", - "Adds miscellaneous lint checks."); -} // namespace tidy2 - -// This anchor is used to force the linker to link in the generated object file -// and thus register the CTTestModule. -volatile int CTTestModuleAnchorSource = 0; +} // namespace tidy +} // namespace mongo diff --git a/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.h b/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.h new file mode 100644 index 00000000000..af1dbca4684 --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.h @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2023-present MongoDB, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Server Side Public License, version 1, + * as published by MongoDB, Inc. + * + * 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 + * Server Side Public License for more details. + * + * You should have received a copy of the Server Side Public License + * along with this program. If not, see + * <http://www.mongodb.com/licensing/server-side-public-license>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the Server Side Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ +#pragma once + +#include "clang-tidy/ClangTidy.h" +#include "clang-tidy/ClangTidyCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang; +using namespace clang::tidy; +using namespace clang::ast_matchers; + +namespace mongo { +namespace tidy { + +class MongoTestCheck : public ClangTidyCheck { + +public: + MongoTestCheck(StringRef Name, ClangTidyContext* Context); + + void registerMatchers(ast_matchers::MatchFinder* Finder) override; + + void check(const ast_matchers::MatchFinder::MatchResult& Result) override; + +private: +}; + +} // namespace tidy +} // namespace mongo diff --git a/src/mongo/tools/mongo_tidy_checks/MongoTidyModule.cpp b/src/mongo/tools/mongo_tidy_checks/MongoTidyModule.cpp new file mode 100644 index 00000000000..533221d30b9 --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/MongoTidyModule.cpp @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2023-present MongoDB, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Server Side Public License, version 1, + * as published by MongoDB, Inc. + * + * 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 + * Server Side Public License for more details. + * + * You should have received a copy of the Server Side Public License + * along with this program. If not, see + * <http://www.mongodb.com/licensing/server-side-public-license>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the Server Side Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#include "MongoTestCheck.h" + +#include "clang-tidy/ClangTidy.h" +#include "clang-tidy/ClangTidyCheck.h" +#include "clang-tidy/ClangTidyModule.h" +#include "clang-tidy/ClangTidyModuleRegistry.h" + +namespace mongo { +namespace tidy { + +class MongoTidyModule : public ClangTidyModule { +public: + void addCheckFactories(ClangTidyCheckFactories& CheckFactories) override { + CheckFactories.registerCheck<MongoTestCheck>("mongo-test-check"); + } +}; + +// Register the MongoTidyModule using this statically initialized variable. +static ClangTidyModuleRegistry::Add<MongoTidyModule> X("mongo-tidy-module", + "MongoDB custom checks."); + +} // namespace tidy + +// This anchor is used to force the linker to link in the generated object file +// and thus register the MongoTidyModule. +volatile int MongoTidyModuleAnchorSource = 0; + +} // namespace mongo diff --git a/src/mongo/tools/mongo_tidy_checks/SConscript b/src/mongo/tools/mongo_tidy_checks/SConscript index d89da3e5926..9b0d75cbb96 100644 --- a/src/mongo/tools/mongo_tidy_checks/SConscript +++ b/src/mongo/tools/mongo_tidy_checks/SConscript @@ -4,13 +4,12 @@ from buildscripts.toolchains import DEFAULT_DATA_FILE, ToolchainConfig, Toolchai toolchain_clang_tidy_dev_found = False toolchain_found = False - +base_toolchain_bin = None try: toolchain_config = ToolchainConfig(DEFAULT_DATA_FILE, ToolchainPlatform('default')) toolchain_found = toolchain_config.base_path.exists() - - base_revision_path = (toolchain_config.base_path / toolchain_config.aliases['stable'] / 'bin' / - 'clang-tidy').resolve().parent.parent + base_toolchain_bin = (toolchain_config.base_path / toolchain_config.aliases['stable'] / 'bin') + base_revision_path = (base_toolchain_bin / 'clang-tidy').resolve().parent.parent tidy_include = base_revision_path / 'include' tidy_lib = base_revision_path / 'lib' @@ -123,6 +122,7 @@ mongo_custom_check = env.SharedLibrary( target="mongo_tidy_checks", source=[ "MongoTestCheck.cpp", + "MongoTidyModule.cpp", ], LIBDEPS_NO_INHERIT=[ '$BUILD_DIR/third_party/shim_allocator', @@ -130,9 +130,16 @@ mongo_custom_check = env.SharedLibrary( AIB_COMPONENT='mongo-tidy-checks', ) -pretty_printer_test_installed = env.AutoInstall( +env.AutoInstall( target='$PREFIX_LIBDIR', source=mongo_custom_check, AIB_ROLE='runtime', AIB_COMPONENT='mongo-tidy-checks', ) +mongo_tidy_module = env.GetAutoInstalledFiles(mongo_custom_check[0])[0] + +# because compiledb is required for use with clang-tidy and potentially clang-tidy is +# loading the module, we add the module to the compiledb alias. +env.Alias("compiledb", mongo_tidy_module) + +env.SConscript('tests/SConscript', exports=['env', 'mongo_tidy_module', 'base_toolchain_bin']) diff --git a/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheckTestMain.cpp b/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheckTestMain.cpp new file mode 100644 index 00000000000..5702e29e2cf --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheckTestMain.cpp @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2023-present MongoDB, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Server Side Public License, version 1, + * as published by MongoDB, Inc. + * + * 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 + * Server Side Public License for more details. + * + * You should have received a copy of the Server Side Public License + * along with this program. If not, see + * <http://www.mongodb.com/licensing/server-side-public-license>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the Server Side Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +int main(int argc, char* argv[]) { + return 0; +} diff --git a/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheck_unittest.py b/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheck_unittest.py new file mode 100644 index 00000000000..99ce4906d31 --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheck_unittest.py @@ -0,0 +1,122 @@ +import unittest +import subprocess +import sys +import tempfile +import os +import textwrap +import argparse + + +class MongoTidyTests(unittest.TestCase): + TIDY_BIN = None + TIDY_MODULE = None + COMPILE_COMMANDS_FILES = [] + + def write_config(self, config_str: str): + self.config_file = tempfile.NamedTemporaryFile(mode='w', delete=False) + self.config_file.write(config_str) + self.config_file.close() + self.cmd += [f'--clang-tidy-cfg={self.config_file.name}'] + return self.config_file.name + + def run_clang_tidy(self): + p = subprocess.run(self.cmd, capture_output=True, text=True) + passed = self.expected_output is not None and self.expected_output in p.stdout + with open(self.config_file.name) as f: + msg = '\n'.join([ + '>' * 80, + f"Mongo Tidy Unittest {self._testMethodName}: {'PASSED' if passed else 'FAILED'}", + "", + "Command:", + ' '.join(self.cmd), + "", + "With config:", + f.read(), + "", + f"Exit code was: {p.returncode}", + "", + f"Output expected in stdout: {self.expected_output}", + "", + "stdout was:", + p.stdout, + "", + "stderr was:", + p.stderr, + "", + '<' * 80, + ]) + + if passed: + sys.stderr.write(msg) + else: + print(msg) + self.fail() + + with open(f'{os.path.splitext(self.compile_db)[0]}.results', 'w') as results: + results.write(msg) + + def setUp(self): + self.config_file = None + self.expected_output = None + for compiledb in self.COMPILE_COMMANDS_FILES: + if compiledb.endswith("/" + self._testMethodName + ".json"): + self.compile_db = compiledb + if self.compile_db: + self.cmd = [ + sys.executable, + 'buildscripts/clang_tidy.py', + f'--check-module={self.TIDY_MODULE}', + f'--output-dir={os.path.join(os.path.dirname(compiledb), self._testMethodName + "_out")}', + f'--compile-commands={self.compile_db}', + ] + else: + raise(f"ERROR: did not findh matching compiledb for {self._testMethodName}") + + def tearDown(self): + if self.config_file: + self.config_file.close() + os.unlink(self.config_file.name) + + def test_MongoTestCheck(self): + + self.write_config( + textwrap.dedent("""\ + Checks: '-*,mongo-test-check' + WarningsAsErrors: '*' + """)) + + self.expected_output = "ran mongo-test-check!" + + self.run_clang_tidy() + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser() + parser.add_argument('--clang-tidy-path', default='/opt/mongodbtoolchain/v4/bin/clang-tidy', + help="Path to clang-tidy binary.") + parser.add_argument('--mongo-tidy-module', default='build/install/lib/libmongo_tidy_checks.so', + help="Path to mongo tidy check library.") + parser.add_argument( + '--test-compiledbs', action='append', default=[], + help="Used multiple times. Each use adds a test compilation database to use. " + + "The compilation database name must match the unittest method name.") + parser.add_argument('unittest_args', nargs='*') + + args = parser.parse_args() + + MongoTidyTests.TIDY_BIN = args.clang_tidy_path + MongoTidyTests.TIDY_MODULE = args.mongo_tidy_module + MongoTidyTests.COMPILE_COMMANDS_FILES = args.test_compiledbs + + # We need to validate the toolchain can support the load operation for our module. + cmd = [MongoTidyTests.TIDY_BIN, f'-load', MongoTidyTests.TIDY_MODULE, '--list-checks'] + p = subprocess.run(cmd, capture_output=True) + if p.returncode != 0: + print(f"Could not validate toolchain was able to load module {cmd}.") + sys.exit(1) + + # Workaround to allow use to use argparse on top of unittest module. + sys.argv[1:] = args.unittest_args + + unittest.main() diff --git a/src/mongo/tools/mongo_tidy_checks/tests/SConscript b/src/mongo/tools/mongo_tidy_checks/tests/SConscript new file mode 100644 index 00000000000..57b1cb01067 --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/tests/SConscript @@ -0,0 +1,61 @@ +Import('env') +Import('mongo_tidy_module') +Import('base_toolchain_bin') + +import sys +import os +import SCons + +# multiple compilation databases is not supported by ninja +if env.GetOption('ninja') == 'disabled': + + # This list represents the test source files, which should contain a single issue which will be flagged + # by a clang tidy check. The issue should be isolated in as minimal way as possible. + tests = [ + 'test_MongoTestCheck.cpp', + ] + + # So that we can do fast runs, we will generate a separate compilation database file for each + # unittest. To keep things simple we will name the compilation database file after the test. + # We need to create separate environments here because compilation database acts on the current + # environment. + test_objs = [] + compilation_dbs = [] + for test in tests: + test_env = env.Clone() + compilation_dbs += test_env.CompilationDatabase( + os.path.splitext(os.path.basename(test))[0] + ".json") + test_objs += test_env.Object(test) + + # Building a program binary may not be necessary but it does validate the code and tie it together. + test_prog = env.Program( + target='MongoTidyCheck_test', + source=['MongoTidyCheckTestMain.cpp'] + test_objs, + LIBDEPS_NO_INHERIT=[ + '$BUILD_DIR/third_party/shim_allocator', + ], + ) + + # Here we setup the test execution. The test will pythons built in unittest framework + # to execute clang tidy for each test source file from the list above. + test = env.Command( + target='run_MongoTidyCheck_test', + source=[ + 'MongoTidyCheck_unittest.py', + str(base_toolchain_bin / 'clang-tidy'), mongo_tidy_module.abspath + ] + compilation_dbs, + action=SCons.Action.Action( + ' '.join([ + sys.executable, + '${SOURCES[0]}', + '--clang-tidy-path=${SOURCES[1]}', + '--mongo-tidy-module=${SOURCES[2]}', + '${["--test-compiledbs=%s" % src for src in SOURCES[3:]]}', + f"{'' if env.Verbose() else '2> /dev/null'}", + ]), + "" if env.Verbose() else "Runnning mongo tidy checks unittests.", + ), + ) + + env.Alias('+mongo-tidy-tests', test) + env.Depends(test, test_prog) diff --git a/src/mongo/tools/mongo_tidy_checks/tests/test_MongoTestCheck.cpp b/src/mongo/tools/mongo_tidy_checks/tests/test_MongoTestCheck.cpp new file mode 100644 index 00000000000..c1e2479f571 --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/tests/test_MongoTestCheck.cpp @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2023-present MongoDB, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Server Side Public License, version 1, + * as published by MongoDB, Inc. + * + * 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 + * Server Side Public License for more details. + * + * You should have received a copy of the Server Side Public License + * along with this program. If not, see + * <http://www.mongodb.com/licensing/server-side-public-license>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the Server Side Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +void test_func(int test) { + test = 42; +} |