From 6c92217ed98451a2461b3a1253c482c6f7cac31d Mon Sep 17 00:00:00 2001 From: Florian Schmaus <flow@cs.fau.de> Date: Thu, 5 Nov 2020 14:19:01 +0100 Subject: [PATCH] Clarify that EMPER is LGPL-3+ licensed and add license check --- LGPL-3 | 165 ++++++++++++++++++++ LICENSE | 2 + Makefile | 6 +- apps/Main.cpp | 2 + apps/WorkerSleepExample.cpp | 2 + emper/Actor.hpp | 2 + emper/BinaryPrivateSemaphore.cpp | 2 + emper/BinaryPrivateSemaphore.hpp | 2 + emper/Blockable.hpp | 2 + emper/Common.cpp | 2 + emper/Common.hpp | 2 + emper/Context.cpp | 2 + emper/Context.hpp | 2 + emper/ContextManager.cpp | 2 + emper/ContextManager.hpp | 2 + emper/CountingPrivateSemaphore.cpp | 2 + emper/CountingPrivateSemaphore.hpp | 2 + emper/Debug.cpp | 2 + emper/Debug.hpp | 2 + emper/Dispatcher.cpp | 2 + emper/Dispatcher.hpp | 2 + emper/Fiber.cpp | 2 + emper/Fiber.hpp | 2 + emper/FiberManager.cpp | 2 + emper/FiberManager.hpp | 2 + emper/MemoryManager.hpp | 2 + emper/PrivateSemaphore.hpp | 2 + emper/Runtime.cpp | 2 + emper/Runtime.hpp | 2 + emper/RuntimeStrategy.hpp | 2 + emper/RuntimeStrategyStats.hpp | 2 + emper/Scheduler.cpp | 2 + emper/Scheduler.hpp | 2 + emper/Semaphore.cpp | 2 + emper/Semaphore.hpp | 2 + emper/SynchronizedFiber.hpp | 2 + emper/UnboundedBlockingMpscQueue.hpp | 2 + emper/c_emper.cpp | 2 + emper/include/emper-common.h | 2 + emper/include/emper.h | 2 + emper/include/emper.hpp | 2 + emper/lib/DebugUtil.cpp | 2 + emper/lib/DebugUtil.hpp | 2 + emper/lib/adt/BoundedBumpArray.hpp | 2 + emper/lib/adt/LockedQueue.hpp | 2 + emper/lib/adt/LockedUnboundedQueue.hpp | 2 + emper/lib/adt/MpscQueue.hpp | 2 + emper/lib/adt/WsClQueue.hpp | 2 + emper/lib/adt/WsClV2Queue.hpp | 2 + emper/lib/sync/Latch.hpp | 2 + emper/lib/sync/Semaphore.hpp | 2 + emper/strategies/laws/LawsDispatcher.cpp | 2 + emper/strategies/laws/LawsDispatcher.hpp | 2 + emper/strategies/laws/LawsScheduler.cpp | 2 + emper/strategies/laws/LawsScheduler.hpp | 2 + emper/strategies/laws/LawsStrategy.cpp | 2 + emper/strategies/laws/LawsStrategy.hpp | 2 + emper/strategies/laws/LawsStrategyStats.cpp | 2 + emper/strategies/laws/LawsStrategyStats.hpp | 2 + emper/strategies/ws/WsDispatcher.cpp | 2 + emper/strategies/ws/WsDispatcher.hpp | 2 + emper/strategies/ws/WsScheduler.cpp | 2 + emper/strategies/ws/WsScheduler.hpp | 2 + emper/strategies/ws/WsStrategy.cpp | 2 + emper/strategies/ws/WsStrategy.hpp | 2 + emper/strategies/ws/WsStrategyStats.cpp | 2 + emper/strategies/ws/WsStrategyStats.hpp | 2 + eval/SpawnALot.cpp | 2 + eval/TimeToSpawn.cpp | 2 + scripts/versionManager.sh | 2 + tests/CppApiTest.cpp | 2 + tests/SimpleActorTest.cpp | 2 + tests/SimpleFibTest.cpp | 2 + tests/SimpleLawsTest.cpp | 24 ++- tests/SimplestFibTest.cpp | 2 + tests/c_api_test.c | 2 + tools/check-license | 117 ++++++++++++++ 77 files changed, 452 insertions(+), 6 deletions(-) create mode 100644 LGPL-3 create mode 100644 LICENSE create mode 100755 tools/check-license diff --git a/LGPL-3 b/LGPL-3 new file mode 100644 index 00000000..0a041280 --- /dev/null +++ b/LGPL-3 @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..a7832c73 --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +GNU Lesser General Public License, version 3 or any later version. +See LGPL-3 for the full text of this license. diff --git a/Makefile b/Makefile index b37b1526..296e5b00 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ debug: SMOKE_TEST_NINJA_TARGETS += iwyu -smoke-test: all check-format +smoke-test: all check-format check-license cd build && meson test --suite smoke $(NINJA) -C build $(SMOKE_TEST_NINJA_TARGETS) @@ -52,5 +52,9 @@ distclean: clean check-format: ./tools/check-format +.PHONY: check-license +check-license: + ./tools/check-license + stresstest: test ./stresstest/stresstest.sh build/tests/simplest_fib_test diff --git a/apps/Main.cpp b/apps/Main.cpp index 0d568608..85c91dfe 100644 --- a/apps/Main.cpp +++ b/apps/Main.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <stdlib.h> // for exit, EXIT_SUCCESS #include <iostream> // for basic_ostream::operator<< diff --git a/apps/WorkerSleepExample.cpp b/apps/WorkerSleepExample.cpp index b6e2e0d3..06d1ebc9 100644 --- a/apps/WorkerSleepExample.cpp +++ b/apps/WorkerSleepExample.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <stdlib.h> // for exit, EXIT_SUCCESS #include <chrono> // for milliseconds, operator+, hig... diff --git a/emper/Actor.hpp b/emper/Actor.hpp index e43fd9ed..03719caa 100644 --- a/emper/Actor.hpp +++ b/emper/Actor.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> diff --git a/emper/BinaryPrivateSemaphore.cpp b/emper/BinaryPrivateSemaphore.cpp index c20e0ea3..77810cd8 100644 --- a/emper/BinaryPrivateSemaphore.cpp +++ b/emper/BinaryPrivateSemaphore.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "BinaryPrivateSemaphore.hpp" #include <cassert> // for assert diff --git a/emper/BinaryPrivateSemaphore.hpp b/emper/BinaryPrivateSemaphore.hpp index 7e308335..379761b8 100644 --- a/emper/BinaryPrivateSemaphore.hpp +++ b/emper/BinaryPrivateSemaphore.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> // for atomic diff --git a/emper/Blockable.hpp b/emper/Blockable.hpp index 61935a31..19311be8 100644 --- a/emper/Blockable.hpp +++ b/emper/Blockable.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include "Common.hpp" diff --git a/emper/Common.cpp b/emper/Common.cpp index 99cda074..a65097be 100644 --- a/emper/Common.cpp +++ b/emper/Common.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "Common.hpp" #include <cstdio> diff --git a/emper/Common.hpp b/emper/Common.hpp index 43b611fb..2e8f7788 100644 --- a/emper/Common.hpp +++ b/emper/Common.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <functional> diff --git a/emper/Context.cpp b/emper/Context.cpp index 755a125d..40712695 100644 --- a/emper/Context.cpp +++ b/emper/Context.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "Context.hpp" #include <ostream> diff --git a/emper/Context.hpp b/emper/Context.hpp index 312d60d3..0df18a89 100644 --- a/emper/Context.hpp +++ b/emper/Context.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <stdint.h> // for uintptr_t diff --git a/emper/ContextManager.cpp b/emper/ContextManager.cpp index ea000a87..e39c0021 100644 --- a/emper/ContextManager.cpp +++ b/emper/ContextManager.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "ContextManager.hpp" #include <assert.h> // for assert diff --git a/emper/ContextManager.hpp b/emper/ContextManager.hpp index 2037b00c..8e4e28a7 100644 --- a/emper/ContextManager.hpp +++ b/emper/ContextManager.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include "Common.hpp" // for func_t diff --git a/emper/CountingPrivateSemaphore.cpp b/emper/CountingPrivateSemaphore.cpp index cae315d9..7011ac89 100644 --- a/emper/CountingPrivateSemaphore.cpp +++ b/emper/CountingPrivateSemaphore.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "CountingPrivateSemaphore.hpp" #include <cassert> // for assert diff --git a/emper/CountingPrivateSemaphore.hpp b/emper/CountingPrivateSemaphore.hpp index 58627593..9ed3c3ea 100644 --- a/emper/CountingPrivateSemaphore.hpp +++ b/emper/CountingPrivateSemaphore.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> // for atomic_uint, atomic diff --git a/emper/Debug.cpp b/emper/Debug.cpp index e833074f..4079ed80 100644 --- a/emper/Debug.cpp +++ b/emper/Debug.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "Debug.hpp" #include <iostream> // for operator<<, cerr, ostream, basic_ostream diff --git a/emper/Debug.hpp b/emper/Debug.hpp index 0fed216b..2880007e 100644 --- a/emper/Debug.hpp +++ b/emper/Debug.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <map> // for allocator, map diff --git a/emper/Dispatcher.cpp b/emper/Dispatcher.cpp index cc98a092..4179b274 100644 --- a/emper/Dispatcher.cpp +++ b/emper/Dispatcher.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "Dispatcher.hpp" #include <functional> // for _Bind_helper<>::type, bind diff --git a/emper/Dispatcher.hpp b/emper/Dispatcher.hpp index 30e6d52d..d85d2285 100644 --- a/emper/Dispatcher.hpp +++ b/emper/Dispatcher.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <assert.h> // for assert diff --git a/emper/Fiber.cpp b/emper/Fiber.cpp index caa61837..b4b406ef 100644 --- a/emper/Fiber.cpp +++ b/emper/Fiber.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "Fiber.hpp" #include <iostream> // for operator<<, basic_ostream, ostream, basic_ostrea... diff --git a/emper/Fiber.hpp b/emper/Fiber.hpp index e3fa62c0..a679352c 100644 --- a/emper/Fiber.hpp +++ b/emper/Fiber.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> // for atomic_uint, atomic, __atomic_base, memory... diff --git a/emper/FiberManager.cpp b/emper/FiberManager.cpp index 3979bfaf..d13f91cf 100644 --- a/emper/FiberManager.cpp +++ b/emper/FiberManager.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "FiberManager.hpp" #include <cstdlib> // for abort, free, posix_memalign diff --git a/emper/FiberManager.hpp b/emper/FiberManager.hpp index d9234bd3..09b6be65 100644 --- a/emper/FiberManager.hpp +++ b/emper/FiberManager.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include "MemoryManager.hpp" // for MemoryManager diff --git a/emper/MemoryManager.hpp b/emper/MemoryManager.hpp index 7239886f..07ee208b 100644 --- a/emper/MemoryManager.hpp +++ b/emper/MemoryManager.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include "Common.hpp" diff --git a/emper/PrivateSemaphore.hpp b/emper/PrivateSemaphore.hpp index ae435ae6..2b095cdb 100644 --- a/emper/PrivateSemaphore.hpp +++ b/emper/PrivateSemaphore.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include "Blockable.hpp" diff --git a/emper/Runtime.cpp b/emper/Runtime.cpp index 0eae91fb..830b6392 100644 --- a/emper/Runtime.cpp +++ b/emper/Runtime.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "Runtime.hpp" #include <errno.h> // for errno diff --git a/emper/Runtime.hpp b/emper/Runtime.hpp index e1a29071..e573a9a1 100644 --- a/emper/Runtime.hpp +++ b/emper/Runtime.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <pthread.h> // for pthread_t diff --git a/emper/RuntimeStrategy.hpp b/emper/RuntimeStrategy.hpp index 76c32d48..77217e84 100644 --- a/emper/RuntimeStrategy.hpp +++ b/emper/RuntimeStrategy.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once class Runtime; diff --git a/emper/RuntimeStrategyStats.hpp b/emper/RuntimeStrategyStats.hpp index 27f581a9..df1aeb7f 100644 --- a/emper/RuntimeStrategyStats.hpp +++ b/emper/RuntimeStrategyStats.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once class RuntimeStrategyStats { diff --git a/emper/Scheduler.cpp b/emper/Scheduler.cpp index 156a7a69..cda111cf 100644 --- a/emper/Scheduler.cpp +++ b/emper/Scheduler.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "Scheduler.hpp" #include "Runtime.hpp" diff --git a/emper/Scheduler.hpp b/emper/Scheduler.hpp index 9c13b5f0..d735c771 100644 --- a/emper/Scheduler.hpp +++ b/emper/Scheduler.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <functional> // for function diff --git a/emper/Semaphore.cpp b/emper/Semaphore.cpp index 00df3cab..c5cea22c 100644 --- a/emper/Semaphore.cpp +++ b/emper/Semaphore.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "Semaphore.hpp" #include <iostream> // for operator<<, basic_ostream, basic_o... diff --git a/emper/Semaphore.hpp b/emper/Semaphore.hpp index 1f32b0e3..bfb3e018 100644 --- a/emper/Semaphore.hpp +++ b/emper/Semaphore.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <mutex> diff --git a/emper/SynchronizedFiber.hpp b/emper/SynchronizedFiber.hpp index d666530b..844d78b8 100644 --- a/emper/SynchronizedFiber.hpp +++ b/emper/SynchronizedFiber.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include "BinaryPrivateSemaphore.hpp" diff --git a/emper/UnboundedBlockingMpscQueue.hpp b/emper/UnboundedBlockingMpscQueue.hpp index aee0caa5..3ffc9073 100644 --- a/emper/UnboundedBlockingMpscQueue.hpp +++ b/emper/UnboundedBlockingMpscQueue.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <mutex> diff --git a/emper/c_emper.cpp b/emper/c_emper.cpp index dc2bb845..61e7ee80 100644 --- a/emper/c_emper.cpp +++ b/emper/c_emper.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <new> // for operator new #include "BinaryPrivateSemaphore.hpp" // for BinaryPrivateSemaphore, BPS diff --git a/emper/include/emper-common.h b/emper/include/emper-common.h index f73f8cc4..38d57a44 100644 --- a/emper/include/emper-common.h +++ b/emper/include/emper-common.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #ifdef __cplusplus diff --git a/emper/include/emper.h b/emper/include/emper.h index 4c5c5d5d..5b16f797 100644 --- a/emper/include/emper.h +++ b/emper/include/emper.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include "emper-common.h" diff --git a/emper/include/emper.hpp b/emper/include/emper.hpp index a59e6647..17ce9530 100644 --- a/emper/include/emper.hpp +++ b/emper/include/emper.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <cassert> diff --git a/emper/lib/DebugUtil.cpp b/emper/lib/DebugUtil.cpp index 11569f56..bcc87a86 100644 --- a/emper/lib/DebugUtil.cpp +++ b/emper/lib/DebugUtil.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "DebugUtil.hpp" #include <execinfo.h> diff --git a/emper/lib/DebugUtil.hpp b/emper/lib/DebugUtil.hpp index e2ab57aa..9bfe9a80 100644 --- a/emper/lib/DebugUtil.hpp +++ b/emper/lib/DebugUtil.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once void enableStacktraceOnAborts(); diff --git a/emper/lib/adt/BoundedBumpArray.hpp b/emper/lib/adt/BoundedBumpArray.hpp index a744c92a..7487991a 100644 --- a/emper/lib/adt/BoundedBumpArray.hpp +++ b/emper/lib/adt/BoundedBumpArray.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once namespace adt { diff --git a/emper/lib/adt/LockedQueue.hpp b/emper/lib/adt/LockedQueue.hpp index 267653e6..4b10b7f2 100644 --- a/emper/lib/adt/LockedQueue.hpp +++ b/emper/lib/adt/LockedQueue.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <deque> diff --git a/emper/lib/adt/LockedUnboundedQueue.hpp b/emper/lib/adt/LockedUnboundedQueue.hpp index 8c510001..d858333e 100644 --- a/emper/lib/adt/LockedUnboundedQueue.hpp +++ b/emper/lib/adt/LockedUnboundedQueue.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once namespace adt { diff --git a/emper/lib/adt/MpscQueue.hpp b/emper/lib/adt/MpscQueue.hpp index 536c9936..be344337 100644 --- a/emper/lib/adt/MpscQueue.hpp +++ b/emper/lib/adt/MpscQueue.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> diff --git a/emper/lib/adt/WsClQueue.hpp b/emper/lib/adt/WsClQueue.hpp index 2d8700b0..a6950556 100644 --- a/emper/lib/adt/WsClQueue.hpp +++ b/emper/lib/adt/WsClQueue.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> diff --git a/emper/lib/adt/WsClV2Queue.hpp b/emper/lib/adt/WsClV2Queue.hpp index e080a299..6f392f8b 100644 --- a/emper/lib/adt/WsClV2Queue.hpp +++ b/emper/lib/adt/WsClV2Queue.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> diff --git a/emper/lib/sync/Latch.hpp b/emper/lib/sync/Latch.hpp index d13ee083..bc7dd180 100644 --- a/emper/lib/sync/Latch.hpp +++ b/emper/lib/sync/Latch.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> diff --git a/emper/lib/sync/Semaphore.hpp b/emper/lib/sync/Semaphore.hpp index a5d43ef1..13fa714b 100644 --- a/emper/lib/sync/Semaphore.hpp +++ b/emper/lib/sync/Semaphore.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <condition_variable> diff --git a/emper/strategies/laws/LawsDispatcher.cpp b/emper/strategies/laws/LawsDispatcher.cpp index fa6c27bf..a935e55b 100644 --- a/emper/strategies/laws/LawsDispatcher.cpp +++ b/emper/strategies/laws/LawsDispatcher.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "LawsDispatcher.hpp" #include "LawsStrategy.hpp" // IWYU pragma: keep diff --git a/emper/strategies/laws/LawsDispatcher.hpp b/emper/strategies/laws/LawsDispatcher.hpp index 80446a12..32b64995 100644 --- a/emper/strategies/laws/LawsDispatcher.hpp +++ b/emper/strategies/laws/LawsDispatcher.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include "Dispatcher.hpp" diff --git a/emper/strategies/laws/LawsScheduler.cpp b/emper/strategies/laws/LawsScheduler.cpp index c29f36c7..83f270ec 100644 --- a/emper/strategies/laws/LawsScheduler.cpp +++ b/emper/strategies/laws/LawsScheduler.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "LawsScheduler.hpp" #include "Common.hpp" diff --git a/emper/strategies/laws/LawsScheduler.hpp b/emper/strategies/laws/LawsScheduler.hpp index 07b4f3d3..61b95288 100644 --- a/emper/strategies/laws/LawsScheduler.hpp +++ b/emper/strategies/laws/LawsScheduler.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <stddef.h> diff --git a/emper/strategies/laws/LawsStrategy.cpp b/emper/strategies/laws/LawsStrategy.cpp index c5fc5f64..eba0340a 100644 --- a/emper/strategies/laws/LawsStrategy.cpp +++ b/emper/strategies/laws/LawsStrategy.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "LawsStrategy.hpp" #include "strategies/laws/LawsDispatcher.hpp" // for LawsDispatcher diff --git a/emper/strategies/laws/LawsStrategy.hpp b/emper/strategies/laws/LawsStrategy.hpp index 4d6a6b13..a65027a4 100644 --- a/emper/strategies/laws/LawsStrategy.hpp +++ b/emper/strategies/laws/LawsStrategy.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> diff --git a/emper/strategies/laws/LawsStrategyStats.cpp b/emper/strategies/laws/LawsStrategyStats.cpp index 5d736548..16e42c3d 100644 --- a/emper/strategies/laws/LawsStrategyStats.cpp +++ b/emper/strategies/laws/LawsStrategyStats.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "LawsStrategyStats.hpp" #include <atomic> diff --git a/emper/strategies/laws/LawsStrategyStats.hpp b/emper/strategies/laws/LawsStrategyStats.hpp index d8cf7cf1..c3231d52 100644 --- a/emper/strategies/laws/LawsStrategyStats.hpp +++ b/emper/strategies/laws/LawsStrategyStats.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <cstdint> diff --git a/emper/strategies/ws/WsDispatcher.cpp b/emper/strategies/ws/WsDispatcher.cpp index 80de76fb..14202e7b 100644 --- a/emper/strategies/ws/WsDispatcher.cpp +++ b/emper/strategies/ws/WsDispatcher.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "WsDispatcher.hpp" #include "Runtime.hpp" // for Runtime diff --git a/emper/strategies/ws/WsDispatcher.hpp b/emper/strategies/ws/WsDispatcher.hpp index b754d672..134925f0 100644 --- a/emper/strategies/ws/WsDispatcher.hpp +++ b/emper/strategies/ws/WsDispatcher.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include "Dispatcher.hpp" diff --git a/emper/strategies/ws/WsScheduler.cpp b/emper/strategies/ws/WsScheduler.cpp index 2083376f..73c9dacd 100644 --- a/emper/strategies/ws/WsScheduler.cpp +++ b/emper/strategies/ws/WsScheduler.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "WsScheduler.hpp" #include <ostream> diff --git a/emper/strategies/ws/WsScheduler.hpp b/emper/strategies/ws/WsScheduler.hpp index 3286f6da..06d45900 100644 --- a/emper/strategies/ws/WsScheduler.hpp +++ b/emper/strategies/ws/WsScheduler.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <stddef.h> // for size_t diff --git a/emper/strategies/ws/WsStrategy.cpp b/emper/strategies/ws/WsStrategy.cpp index 3162da16..54138fc2 100644 --- a/emper/strategies/ws/WsStrategy.cpp +++ b/emper/strategies/ws/WsStrategy.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "WsStrategy.hpp" #include "WsDispatcher.hpp" diff --git a/emper/strategies/ws/WsStrategy.hpp b/emper/strategies/ws/WsStrategy.hpp index 8386b5a2..24451bc0 100644 --- a/emper/strategies/ws/WsStrategy.hpp +++ b/emper/strategies/ws/WsStrategy.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <atomic> diff --git a/emper/strategies/ws/WsStrategyStats.cpp b/emper/strategies/ws/WsStrategyStats.cpp index e5a50e88..41cb6ae5 100644 --- a/emper/strategies/ws/WsStrategyStats.cpp +++ b/emper/strategies/ws/WsStrategyStats.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include "WsStrategyStats.hpp" #include <atomic> diff --git a/emper/strategies/ws/WsStrategyStats.hpp b/emper/strategies/ws/WsStrategyStats.hpp index cb5a14ad..ba92b37a 100644 --- a/emper/strategies/ws/WsStrategyStats.hpp +++ b/emper/strategies/ws/WsStrategyStats.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #include <cstdint> diff --git a/eval/SpawnALot.cpp b/eval/SpawnALot.cpp index eff5cf35..4f0b0a90 100644 --- a/eval/SpawnALot.cpp +++ b/eval/SpawnALot.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <stdint.h> // for uint8_t, uint64_t #include <stdlib.h> // for EXIT_SUCCESS diff --git a/eval/TimeToSpawn.cpp b/eval/TimeToSpawn.cpp index 488c1e30..69792336 100644 --- a/eval/TimeToSpawn.cpp +++ b/eval/TimeToSpawn.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <chrono> // for nanoseconds, duration_cast #include <iostream> // for operator<<, basic_ostream, endl #include <mutex> // for mutex diff --git a/scripts/versionManager.sh b/scripts/versionManager.sh index 73cb903c..594b1109 100755 --- a/scripts/versionManager.sh +++ b/scripts/versionManager.sh @@ -73,6 +73,8 @@ checkVersionHeader() { fi cat <<EOF > "$versionHeader" +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #pragma once #define EMPER_MAJOR_VERSION ${EMPER_MAJOR_VERSION} diff --git a/tests/CppApiTest.cpp b/tests/CppApiTest.cpp index 954ad76c..71864a75 100644 --- a/tests/CppApiTest.cpp +++ b/tests/CppApiTest.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <stdlib.h> // for exit, EXIT_FAILURE, EXIT_SUC... #include <atomic> // for atomic_uint, __atomic_base diff --git a/tests/SimpleActorTest.cpp b/tests/SimpleActorTest.cpp index d00480a6..92e5491a 100644 --- a/tests/SimpleActorTest.cpp +++ b/tests/SimpleActorTest.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <stdlib.h> // for exit, EXIT_FAILURE, EXIT_SUC... #include <atomic> // for atomic_thread_fence, memory_... diff --git a/tests/SimpleFibTest.cpp b/tests/SimpleFibTest.cpp index 1ac4a786..f97f9476 100644 --- a/tests/SimpleFibTest.cpp +++ b/tests/SimpleFibTest.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <stdlib.h> // for exit, EXIT_FAILURE, EXIT_SUC... #include "BinaryPrivateSemaphore.hpp" // for BPS diff --git a/tests/SimpleLawsTest.cpp b/tests/SimpleLawsTest.cpp index 98ad269f..ca524c35 100644 --- a/tests/SimpleLawsTest.cpp +++ b/tests/SimpleLawsTest.cpp @@ -1,8 +1,22 @@ -#include <random> - -#include "Fiber.hpp" -#include "emper.hpp" -#include "strategies/laws/LawsStrategy.hpp" +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus +#include <stdint.h> // for uint64_t, UINT64_MAX +#include <stdlib.h> // for free, exit, EXIT_FAILURE +#include <string.h> // for memset + +#include <atomic> // for atomic, __atomic_base +#include <iostream> // for operator<<, endl, basic_... +#include <new> // for operator new[] +#include <random> // for mt19937_64, random_device + +#include "Common.hpp" // for ALIGN_TO_CACHE_LINE +#include "CountingPrivateSemaphore.hpp" // for CPS +#include "Fiber.hpp" // for Fiber, Fiber::NOT_AFFINE +#include "Runtime.hpp" // for Runtime +#include "emper-common.h" // for UNUSED_ARG, workeraffini... +#include "strategies/laws/LawsStrategy.hpp" // for LawsStrategy, LawsStrate... + +class RuntimeStrategy; static const unsigned int ROUND_COUNT = 10; static const unsigned int FIBER_LOOPS = 10; diff --git a/tests/SimplestFibTest.cpp b/tests/SimplestFibTest.cpp index 3f5a5a95..3e5c5f4c 100644 --- a/tests/SimplestFibTest.cpp +++ b/tests/SimplestFibTest.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <cstdlib> // for abort, exit, EXIT_SUCCESS #include <iostream> // for operator<<, basic_ostream::o... diff --git a/tests/c_api_test.c b/tests/c_api_test.c index 2cfbbd92..a9ef015d 100644 --- a/tests/c_api_test.c +++ b/tests/c_api_test.c @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus #include <stdlib.h> #include "emper-common.h" diff --git a/tools/check-license b/tools/check-license new file mode 100755 index 00000000..f77900e2 --- /dev/null +++ b/tools/check-license @@ -0,0 +1,117 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Pretty fancy method to get reliable the absolute path of a shell +# script, *even if it is sourced*. Credits go to GreenFox on +# stackoverflow: http://stackoverflow.com/a/12197518/194894 +pushd . > /dev/null +SCRIPTDIR="${BASH_SOURCE[0]}"; +while([ -h "${SCRIPTDIR}" ]); do + cd "`dirname "${SCRIPTDIR}"`" + SCRIPTDIR="$(readlink "`basename "${SCRIPTDIR}"`")"; +done +cd "`dirname "${SCRIPTDIR}"`" > /dev/null +SCRIPTDIR="`pwd`"; +popd > /dev/null + +echoerr() { echo "$@" 1>&2; } + +AUTOFIX=false +VERBOSE=false + +while getopts :dfv OPT; do + case $OPT in + d) + set -x + ;; + f) + AUTOFIX=true + ;; + v) + VERBOSE=true + ;; + *) + echo "usage: ${0##*/} [-d]" + exit 2 + esac +done +shift $(( OPTIND - 1 )) +OPTIND=1 + +export ROOTDIR +ROOTDIR=$(readlink -f "${SCRIPTDIR}/..") + +export CHECKED_FILES_FILE +CHECKED_FILES_FILE=$(mktemp) +export INVALID_LICENSE_FILES_FILE +INVALID_LICENSE_FILES_FILE=$(mktemp) + +function cleanup() { + rm "${CHECKED_FILES_FILE}" + rm "${INVALID_LICENSE_FILES_FILE}" +} +trap cleanup EXIT + +# Safely call bash function from xargs +# https://stackoverflow.com/questions/11003418/calling-shell-functions-with-xargs/11003457#11003457 +check_license() { + echo "${1}" >> "${CHECKED_FILES_FILE}" + + local license_identifier=".*SPDX-License-Identifier: LGPL-3.0-or-later" + local copyright_regex=".*Copyright (© )?[0-9]{4}(-[0-9]{4})?( \w)+.*" + local sed_cmd="{N; N; /^${license_identifier}\n${copyright_regex}\n.+$/!{q1}}" + + local full_path="${ROOTDIR}/${1}" + if ! head --lines=3 "${full_path}" |\ + sed --regexp-extended --quiet "${sed_cmd}" >/dev/null + then + echo "${1}" >> "${INVALID_LICENSE_FILES_FILE}" + return 1 + fi +} +export -f check_license + + +MAX_PROCS=$(nproc) + +cd "${ROOTDIR}" + +set +e +find . \( -path '*/\.*' -o -path "./build*" -o -path "./test/3rd-party*" \) -prune -o \ + -type f -regextype posix-extended -regex '.*\.(c|h|cpp|hpp)' -print0 |\ + xargs --null --max-args=1 --max-procs="${MAX_PROCS}" -I {} \ + bash -c 'check_license "$@"' _ "{}" +readonly CHECK_RETURN_VALUE="$?" +set -e + +if [[ $CHECK_RETURN_VALUE -ne 0 ]]; then + mapfile -t < "${INVALID_LICENSE_FILES_FILE}" + echoerr "The following ${#MAPFILE[@]} files have a missing or invalid license header:" + for INVALID_LICENSE_FILE in "${MAPFILE[@]}"; do + echoerr "- ${INVALID_LICENSE_FILE}" + done + + if $AUTOFIX; then + echo "Autofixing enabled, prepending default header to those files" + for INVALID_LICENSE_FILE in "${MAPFILE[@]}"; do + TMPFILE=$(mktemp) + + cat <<EOF > "${TMPFILE}" +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright © 2020 Florian Schmaus +EOF + cat "${INVALID_LICENSE_FILE}" >> "${TMPFILE}" + mv "${TMPFILE}" "${INVALID_LICENSE_FILE}" + done + fi + exit "${CHECK_RETURN_VALUE}" +fi + +FILE_COUNT=$(<"${CHECKED_FILES_FILE}" wc -l) +echo "Checked ${FILE_COUNT} files for license headers" +if $VERBOSE; then + mapfile -t < "${CHECKED_FILES_FILE}" + for FILE in "${MAPFILE[@]}"; do + echo "- ${FILE}" + done +fi -- GitLab