summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/CMakeLists.txt3
-rwxr-xr-xscripts/buildtests.sh135
-rw-r--r--[-rwxr-xr-x]scripts/mkderivedcomponents.pl27
-rw-r--r--[-rwxr-xr-x]scripts/mkderivedparameters.pl10
-rw-r--r--[-rwxr-xr-x]scripts/mkderivedproperties.pl12
-rw-r--r--[-rwxr-xr-x]scripts/mkderivedvalues.pl14
-rw-r--r--[-rwxr-xr-x]scripts/mkrestrictiontable.pl44
-rw-r--r--scripts/readvaluesfile.pl56
-rw-r--r--scripts/set_compiler_env.bat3
-rwxr-xr-xscripts/setup-travis.sh3
10 files changed, 206 insertions, 101 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 0b7b3433..b650e8dc 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -1,3 +1,4 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
########### install files ###############
-
diff --git a/scripts/buildtests.sh b/scripts/buildtests.sh
index c379ddce..b76b192f 100755
--- a/scripts/buildtests.sh
+++ b/scripts/buildtests.sh
@@ -1,5 +1,8 @@
#!/bin/bash
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
#Exit if any undefined variable is used.
set -u
#Exit this script if it any subprocess exits non-zero.
@@ -28,17 +31,20 @@ HELP() {
echo
echo "Run build tests"
echo "Options:"
- echo " -m, --no-cmake-compat Don't require CMake version compatibility"
- echo " -k, --no-krazy Don't run any Krazy tests"
- echo " -c, --no-cppcheck Don't run any cppcheck tests"
- echo " -t, --no-tidy Don't run any clang-tidy tests"
- echo " -b, --no-scan Don't run any scan-build tests"
- echo " -s, --no-splint Don't run any splint tests"
- echo " -n, --no-ninja Don't run any build tests with ninja"
- echo " -l, --no-clang-build Don't run any clang-build tests"
- echo " -g, --no-gcc-build Don't run any gcc-build tests"
- echo " -a, --no-asan-build Don't run any ASAN-build tests"
- echo " -d, --no-tsan-build Don't run any TSAN-build tests"
+ echo " -m, --no-cmake-compat Don't require CMake version compatibility"
+ echo " -k, --no-krazy Don't run any Krazy tests"
+ echo " -c, --no-cppcheck Don't run any cppcheck tests"
+ echo " -t, --no-tidy Don't run any clang-tidy tests"
+ echo " -b, --no-scan Don't run any scan-build tests"
+ echo " -s, --no-splint Don't run any splint tests"
+ echo " -p, --no-codespell Don't run any codespell tests"
+ echo " -n, --no-ninja Don't run any build tests with ninja"
+ echo " -l, --no-clang-build Don't run any clang-build tests"
+ echo " -g, --no-gcc-build Don't run any gcc-build tests"
+ echo " -a, --no-asan-build Don't run any ASAN-build (sanitize-address) tests"
+ echo " -d, --no-tsan-build Don't run any TSAN-build (sanitize-threads) tests"
+ echo " -u, --no-ubsan-build Don't run any UBSAN-build (sanitize-undefined) tests"
+ echo " -x, --no-memc-build Don't run any MEMCONSIST-build (memory consistency) tests"
echo
}
@@ -138,7 +144,7 @@ CONFIGURE() {
mkdir -p $BDIR
cd $BDIR
rm -rf *
- cmake .. $2 || exit 1
+ cmake --warn-uninitialized -Werror=dev .. $2 || exit 1
}
#function CLEAN:
@@ -227,8 +233,24 @@ CLANG_BUILD() {
echo "===== END CLANG BUILD: $1 ======"
}
+#function MEMCONSIST_BUILD:
+# runs a gcc memory consistency build test
+# $1 = the name of the test (which will have "-mem" appended to it)
+# $2 = CMake options
+MEMCONSIST_BUILD() {
+ name="$1-mem"
+ if ( test $runmemcbuild -ne 1 )
+ then
+ echo "===== MEMCONSIST BUILD TEST $1 DISABLED DUE TO COMMAND LINE OPTION ====="
+ return
+ fi
+ echo "===== START MEMCONSIST BUILD: $1 ======"
+ BUILD "$name" "-DLIBICAL_DEVMODE_MEMORY_CONSISTENCY=True $2"
+ echo "===== END MEMCONSIST BUILD: $1 ======"
+}
+
#function ASAN_BUILD:
-# runs an clang ASAN build test
+# runs a clang ASAN build test
# $1 = the name of the test (which will have "-asan" appended to it)
# $2 = CMake options
ASAN_BUILD() {
@@ -240,12 +262,12 @@ ASAN_BUILD() {
fi
echo "===== START ASAN BUILD: $1 ======"
SET_CLANG
- BUILD "$name" "-DADDRESS_SANITIZER=True $2"
+ BUILD "$name" "-DLIBICAL_DEVMODE_ADDRESS_SANITIZER=True $2"
echo "===== END ASAN BUILD: $1 ======"
}
#function TSAN_BUILD:
-# runs an clang TSAN build test
+# runs a clang TSAN build test
# $1 = the name of the test (which will have "-tsan" appended to it)
# $2 = CMake options
TSAN_BUILD() {
@@ -257,10 +279,27 @@ TSAN_BUILD() {
fi
echo "===== START TSAN BUILD: $1 ======"
SET_CLANG
- BUILD "$name" "-DTHREAD_SANITIZER=True $2"
+ BUILD "$name" "-DLIBICAL_DEVMODE_THREAD_SANITIZER=True $2"
echo "===== END TSAN BUILD: $1 ======"
}
+#function UBSAN_BUILD:
+# runs a clang UBSAN build test
+# $1 = the name of the test (which will have "-ubsan" appended to it)
+# $2 = CMake options
+UBSAN_BUILD() {
+ name="$1-ubsan"
+ if ( test $runubsanbuild -ne 1 )
+ then
+ echo "===== UBSAN BUILD TEST $1 DISABLED DUE TO COMMAND LINE OPTION ====="
+ return
+ fi
+ echo "===== START UBSAN BUILD: $1 ======"
+ SET_CLANG
+ BUILD "$name" "-DLIBICAL_DEVMODE_UNDEFINED_SANITIZER=True $2"
+ echo "===== END UBSAN BUILD: $1 ======"
+}
+
#function CPPCHECK
# runs a cppcheck test, which means: configure, compile, link and run cppcheck
# $1 = the name of the test (which will have "-cppcheck" appended to it)
@@ -295,6 +334,10 @@ CPPCHECK() {
-D PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP=0 \
-D MIN="" \
-D _unused="(void)" \
+ -D _deprecated="(void)" \
+ -D ICALMEMORY_DEFAULT_FREE="free" \
+ -D ICALMEMORY_DEFAULT_MALLOC="malloc" \
+ -D ICALMEMORY_DEFAULT_REALLOC="realloc" \
-D F_OK=0 \
-D R_OK=0 \
-U YYSTYPE \
@@ -311,7 +354,7 @@ CPPCHECK() {
grep -v Net-ICal | \
grep -v icalssyacc\.c | \
grep -v icalsslexer\.c | \
- grep -v vcc\.c | \
+ grep -v vcc\.c | grep -v vcc\.y | \
grep -v _cxx\. | tee cppcheck.out
CPPCHECK_WARNINGS cppcheck.out
rm -f cppcheck.out
@@ -354,6 +397,7 @@ SPLINT() {
splint $files \
-badflag \
+ -preproc \
-weak -warnposix \
-modobserver -initallelements -redef \
-linelen 1000 \
@@ -475,16 +519,39 @@ KRAZY() {
echo "===== END KRAZY ======"
}
+#function CODESPELL
+# runs a codespell test
+CODESPELL() {
+ if ( test $runcodespell -ne 1 )
+ then
+ echo "===== CODESPELL TEST DISABLED DUE TO COMMAND LINE OPTION ====="
+ return
+ fi
+ COMMAND_EXISTS "codespell"
+ echo "===== START CODESPELL ====="
+ cd $TOP
+ codespell --interactive=0 . 2>&1 | tee codespell.out
+ status=$?
+ if ( test $status -gt 0 )
+ then
+ echo "Codespell warnings encountered. Exiting..."
+ exit 1
+ fi
+ rm -f codespell.out
+ echo "===== END CODESPELL ======"
+}
+
##### END FUNCTIONS #####
-#TEMP=`getopt -o hmkctbsnlgad --long help,no-cmake-compat,no-krazy,no-cppcheck,no-tidy,no-scan,no-splint,no-ninja,no-clang-build,no-gcc-build,no-asan-build,no-tsan-build -- "$@"`
-TEMP=`getopt hmkctbsnlgad $*`
+#TEMP=`getopt -o hmkpctbsnlgadu --long help,no-cmake-compat,no-krazy,no-codespell,no-cppcheck,no-tidy,no-scan,no-splint,no-ninja,no-clang-build,no-gcc-build,no-asan-build,no-tsan-build,no-ubsan-build,no-memc-build -- "$@"`
+TEMP=`getopt hmkpctbsnlgadux $*`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
cmakecompat=1
runkrazy=1
+runcodespell=1
runcppcheck=1
runtidy=1
runscan=1
@@ -493,12 +560,15 @@ runclangbuild=1
rungccbuild=1
runasanbuild=1
runtsanbuild=1
+runubsanbuild=1
+runmemcbuild=1
runsplint=1
-while true ; do
+while true; do
case "$1" in
-h|--help) HELP; exit 1;;
-m|--no-cmake-compat) cmakecompat=0; shift;;
-k|--no-krazy) runkrazy=0; shift;;
+ -p|--no-codespell) runcodespell=0; shift;;
-c|--no-cppcheck) runcppcheck=0; shift;;
-t|--no-tidy) runtidy=0; shift;;
-b|--no-scan) runscan=0; shift;;
@@ -508,6 +578,8 @@ while true ; do
-g|--no-gcc-build) rungccbuild=0; shift;;
-a|--no-asan-build) runasanbuild=0; shift;;
-d|--no-tsan-build) runtsanbuild=0; shift;;
+ -u|--no-ubsan-build) runubsanbuild=0; shift;;
+ -x|--no-memc-build) runmemcbuild=0; shift;;
--) shift; break;;
*) echo "Internal error!"; exit 1;;
esac
@@ -557,10 +629,12 @@ DEFCMAKEOPTS="-DCMAKE_BUILD_TYPE=Debug"
CMAKEOPTS="-DCMAKE_BUILD_TYPE=Debug -DGOBJECT_INTROSPECTION=False -DICAL_GLIB=False -DICAL_BUILD_DOCS=False"
UUCCMAKEOPTS="$CMAKEOPTS -DCMAKE_DISABLE_FIND_PACKAGE_ICU=True"
TZCMAKEOPTS="$CMAKEOPTS -DUSE_BUILTIN_TZDATA=True"
+LTOCMAKEOPTS="$CMAKEOPTS -DENABLE_LTO_BUILD=True"
GLIBOPTS="-DCMAKE_BUILD_TYPE=Debug -DGOBJECT_INTROSPECTION=True -DUSE_BUILTIN_TZDATA=OFF -DICAL_GLIB_VAPI=ON"
#Static code checkers
KRAZY
+CODESPELL
SPLINT test2 "$CMAKEOPTS"
SPLINT test2builtin "$TZCMAKEOPTS"
CPPCHECK test2 "$CMAKEOPTS"
@@ -574,7 +648,12 @@ CLANGTIDY test2builtin "$TZCMAKEOPTS"
GCC_BUILD testgcc1 "$DEFCMAKEOPTS"
GCC_BUILD testgcc2 "$CMAKEOPTS"
GCC_BUILD testgcc3 "$UUCCMAKEOPTS"
+if (test "`uname -s`" = "Linux")
+then
+ GCC_BUILD testgcc4lto "$LTOCMAKEOPTS"
+fi
GCC_BUILD testgcc4glib "$GLIBOPTS"
+GCC_BUILD testgccnocxx "$CMAKEOPTS -DWITH_CXX_BINDINGS=off"
if (test "`uname -s`" = "Linux")
then
echo "Temporarily disable cross-compile tests"
@@ -597,6 +676,7 @@ NINJA_GCC_BUILD testninjagcc9 "-DSHARED_ONLY=True -DICAL_GLIB=True -DGOBJECT_INT
CLANG_BUILD testclang1 "$DEFCMAKEOPTS"
CLANG_BUILD testclang2 "$CMAKEOPTS"
CLANG_BUILD testclang3 "$UUCCMAKEOPTS"
+#not supported with clang yet CLANG_BUILD testclang4lto "$LTOCMAKEOPTS"
CLANG_BUILD testclang4glib "$GLIBOPTS"
if (test "`uname -s`" = "Linux")
then
@@ -605,6 +685,14 @@ then
# CLANG_BUILD testclang2cross "-DCMAKE_TOOLCHAIN_FILE=$TOP/cmake/Toolchain-Linux-GCC-i686.cmake $CMAKEOPTS"
fi
+#Memory consistency check
+MEMCONSIST_BUILD test1memc ""
+MEMCONSIST_BUILD test2memc "$CMAKEOPTS"
+MEMCONSIST_BUILD test3memc "$TZCMAKEOPTS"
+MEMCONSIST_BUILD test4memc "$UUCCMAKEOPTS"
+#FIXME: the python test scripts for introspection need some love
+#MEMCONSIST_BUILD test5memc "$GLIBOPTS"
+
#Address sanitizer
ASAN_BUILD test1asan "$DEFCMAKEOPTS"
ASAN_BUILD test2asan "$CMAKEOPTS"
@@ -619,4 +707,11 @@ TSAN_BUILD test3tsan "$TZCMAKEOPTS"
TSAN_BUILD test4tsan "$UUCCMAKEOPTS"
TSAN_BUILD test5tsan "$GLIBOPTS"
+#Undefined sanitizer
+UBSAN_BUILD test1ubsan ""
+UBSAN_BUILD test2ubsan "$CMAKEOPTS"
+UBSAN_BUILD test3ubsan "$TZCMAKEOPTS"
+UBSAN_BUILD test4ubsan "$UUCCMAKEOPTS"
+UBSAN_BUILD test5ubsan "$GLIBOPTS"
+
echo "ALL TESTS COMPLETED SUCCESSFULLY"
diff --git a/scripts/mkderivedcomponents.pl b/scripts/mkderivedcomponents.pl
index fcd98f24..2d51f4d4 100755..100644
--- a/scripts/mkderivedcomponents.pl
+++ b/scripts/mkderivedcomponents.pl
@@ -1,17 +1,8 @@
#!/usr/bin/env perl
################################################################################
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
################################################################################
use Getopt::Std;
@@ -69,19 +60,9 @@ if ($opt_c or $opt_h and !$opt_i) {
\044Id:\044
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
-
- The contents of this file are subject to the Mozilla Public License
- Version 1.0 (the "License"); you may not use this file except in
- compliance with the License. You may obtain a copy of the License at
- https://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS"
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- the License for the specific language governing rights and
- limitations under the License.
-
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
/*
diff --git a/scripts/mkderivedparameters.pl b/scripts/mkderivedparameters.pl
index 05aea1c2..26091ca5 100755..100644
--- a/scripts/mkderivedparameters.pl
+++ b/scripts/mkderivedparameters.pl
@@ -1,17 +1,11 @@
#!/usr/bin/env perl
################################################################################
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
################################################################################
require "readvaluesfile.pl";
diff --git a/scripts/mkderivedproperties.pl b/scripts/mkderivedproperties.pl
index b6355676..7e1d9065 100755..100644
--- a/scripts/mkderivedproperties.pl
+++ b/scripts/mkderivedproperties.pl
@@ -1,17 +1,11 @@
#!/usr/bin/env perl
################################################################################
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
################################################################################
require "readvaluesfile.pl";
@@ -175,7 +169,7 @@ sub insert_code
if ($e eq "NONE") {
my ($tbd) = 1;
$saveidx++;
- for (; $saveidx < $idx ; $saveidx++, $tbd++) {
+ for (; $saveidx < $idx; $saveidx++, $tbd++) {
$lines{$saveidx} =
" {ICAL_${ucv}_PROPERTY,ICAL_${ucv}_NONE, \"\" }, /*$saveidx*/\n";
}
diff --git a/scripts/mkderivedvalues.pl b/scripts/mkderivedvalues.pl
index 76c67d9e..c2125df7 100755..100644
--- a/scripts/mkderivedvalues.pl
+++ b/scripts/mkderivedvalues.pl
@@ -1,17 +1,11 @@
#!/usr/bin/perl
################################################################################
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
################################################################################
use lib '.';
@@ -92,7 +86,7 @@ sub insert_code
}
$idx = $h{'NO'}->{"kindEnum"};
- print " ICAL_NO_VALUE=$idx\n} icalvalue_kind ;\n\n";
+ print " ICAL_NO_VALUE=$idx\n} icalvalue_kind;\n\n";
# Now create enumerations for property values
$lastidx = $idx = 10000;
@@ -226,7 +220,7 @@ $pointer_check_rv\
if ($union_data eq 'string') {
print
-" if (impl->data.v_${union_data} != 0) {\n free((void *)impl->data.v_${union_data});\n }\n";
+" if (impl->data.v_${union_data} != 0) {\n icalmemory_free_buffer((void *)impl->data.v_${union_data});\n }\n";
}
print "\
diff --git a/scripts/mkrestrictiontable.pl b/scripts/mkrestrictiontable.pl
index 21bc499a..541bb4b0 100755..100644
--- a/scripts/mkrestrictiontable.pl
+++ b/scripts/mkrestrictiontable.pl
@@ -1,17 +1,11 @@
#!/usr/bin/env perl
################################################################################
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
################################################################################
use Getopt::Std;
@@ -47,8 +41,9 @@ if ($opt_i) {
sub insert_code
{
- # First build the property restriction table
- print "static const icalrestriction_property_record icalrestriction_property_records[] = {\n";
+ # First parse the restrictions file and make a hash of the restrictions
+ my @prop_restr = ();
+ my @comp_restr = ();
while (<F>) {
@@ -67,17 +62,36 @@ sub insert_code
}
$restr =~ s/\s+$//;
- if ($prop ne "NONE") {
- print(
-" \{ICAL_METHOD_${method}, ICAL_${targetcomp}_COMPONENT, ICAL_${prop}_PROPERTY, ICAL_RESTRICTION_${restr}, $sub},\n"
- );
+ if ($prop eq "NONE") {
+ $prop = "NO";
+ }
+ if ($subcomp eq "NONE") {
+ $subcomp = "NO";
}
+ my @value = ($restr, $sub);
+ $prop_restr{$method}{$targetcomp}{$prop}{$subcomp} = \@value;
}
+ # Build the restriction table
+ print "static const icalrestriction_record icalrestriction_records[] = {\n";
+
+ for $method ( sort keys %prop_restr ) {
+ for $targetcomp ( sort keys %{ $prop_restr{$method} } ) {
+ for $prop ( sort keys %{ $prop_restr{$method}{$targetcomp} } ) {
+ for $subcomp ( sort keys %{ $prop_restr{$method}{$targetcomp}{$prop} } ) {
+ my ($restr, $sub) = @{$prop_restr{$method}{$targetcomp}{$prop}{$subcomp}};
+ print(
+" \{ICAL_METHOD_${method}, ICAL_${targetcomp}_COMPONENT, ICAL_${prop}_PROPERTY, ICAL_${subcomp}_COMPONENT, ICAL_RESTRICTION_${restr}, $sub},\n"
+ );
+ }
+ }
+ }
+}
+
# Print the terminating line
print
- " {ICAL_METHOD_NONE, ICAL_NO_COMPONENT, ICAL_NO_PROPERTY, ICAL_RESTRICTION_NONE, NULL}\n";
+ " {ICAL_METHOD_NONE, ICAL_NO_COMPONENT, ICAL_NO_PROPERTY, ICAL_NO_COMPONENT, ICAL_RESTRICTION_NONE, NULL}\n";
print "};\n";
diff --git a/scripts/readvaluesfile.pl b/scripts/readvaluesfile.pl
index 460cf7e7..3e1cb8d7 100644
--- a/scripts/readvaluesfile.pl
+++ b/scripts/readvaluesfile.pl
@@ -1,16 +1,10 @@
################################################################################
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
################################################################################
sub read_values_file
@@ -18,10 +12,13 @@ sub read_values_file
my $path = shift;
my %h;
+ my @SEEN_ENUMS;
open(F, $path) || die "Can't open values file $path";
+ my $line = 0;
while (<F>) {
+ $line++;
chop;
@@ -34,8 +31,16 @@ sub read_values_file
@column = split(/,/, $_);
my $value_name = $column[0];
- my $enumConst = $column[1];
-
+ if (exists($h{$value_name})) {
+ die "Previously defined value=$value_name line $line in $path";
+ }
+ my $enumConst = $column[1];
+ if ($enumConst !~ /FIXME/) {
+ if (grep(/^$enumConst$/, @SEEN)) {
+ die "Reusing kindEnum=$enumConst line $line in $path";
+ }
+ push(@SEEN, $enumConst);
+ }
my $c_type_str = $column[2];
my $c_autogen = ($c_type_str =~ /\(a\)/);
@@ -79,11 +84,13 @@ sub read_properties_file
my $path = shift;
my %h;
+ my @SEEN;
open(F, $path) || die "Can't open properties file $path";
+ my $line = 0;
while (<F>) {
-
+ $line++;
chop;
s/#.*$//g;
@@ -95,8 +102,16 @@ sub read_properties_file
@column = split(/,/, $_);
my $property_name = $column[0];
-
- my $enumConst = $column[1];
+ if ($property_name && exists($h{$property_name})) {
+ die "Previously defined property=$property_name line $line in $path";
+ }
+ my $enumConst = $column[1];
+ if ($enumConst !~ /FIXME/) {
+ if (grep(/^$enumConst$/, @SEEN)) {
+ die "Reusing kindEnum=$enumConst line $line in $path";
+ }
+ push(@SEEN, $enumConst);
+ }
my $lic_value = $column[2];
my $default_value = $column[3];
my $flags = $column[4];
@@ -124,10 +139,13 @@ sub read_parameters_file
my $path = shift;
my %h;
+ my @SEEN;
open(F, $path) || die "Can't open parameters file $path";
+ my $line = 0;
while (<F>) {
+ $line++;
chop;
@@ -140,8 +158,16 @@ sub read_parameters_file
@column = split(/\,/, $_);
my $parameter_name = $column[0];
-
- my $enumConst = $column[1];
+ if (exists($h{$parameter_name})) {
+ die "Previously defined parameter=$parameter_name line $line in $path";
+ }
+ my $enumConst = $column[1];
+ if ($enumConst !~ /FIXME/) {
+ if (grep(/^$enumConst$/, @SEEN)) {
+ die "Reusing kindEnum=$enumConst line $line in $path";
+ }
+ push(@SEEN, $enumConst);
+ }
my $data_type = $column[2];
my $enum_string = $column[3];
diff --git a/scripts/set_compiler_env.bat b/scripts/set_compiler_env.bat
index 47d7c50f..215fb41d 100644
--- a/scripts/set_compiler_env.bat
+++ b/scripts/set_compiler_env.bat
@@ -1,5 +1,8 @@
@echo off
+rem SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+rem SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
:: Now we declare a scope
Setlocal EnableDelayedExpansion EnableExtensions
diff --git a/scripts/setup-travis.sh b/scripts/setup-travis.sh
index 315ee3b2..c6a93c78 100755
--- a/scripts/setup-travis.sh
+++ b/scripts/setup-travis.sh
@@ -1,5 +1,8 @@
#!/bin/bash
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
# things to do for travis-ci in the before_install section
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then