From 7c344b3b2b3278ca8225c0da52e074a74df64e49 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Mon, 9 Dec 2024 10:47:33 +0100 Subject: [PATCH 1/6] copy over .c files to avoid des-instrumentation by the WMC tool --- scripts/prepare_instrumentation.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index f72c3f28d5..2432e969e6 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -185,14 +185,18 @@ shopt -u extglob find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(unsigned long\)\1\)/" \{\} \; # run wmc_tool -"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" >> /dev/null -"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null +"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" +"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" # ISAR post-renderer and lc3plus sources only need to be instrumented in float code if [ "$PROJECT" = "FLOAT" ]; then - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null + cp -R ../lib_rend/*.c $targetdir/lib_rend # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" + cp -R ../lib_lc3plus/*.c $targetdir/lib_lc3plus # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + cp -R ../lib_lc3plus/fft/*.c $targetdir/lib_lc3plus/fft # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" else - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> /dev/null + cp -R ../lib_rend/*.c $targetdir/lib_rend # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" fi # automatically enable #define WMOPS in options.h -- GitLab From 6443f22c8ce3219449d19a1dbbaa6165d9256c41 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Mon, 9 Dec 2024 12:23:35 +0100 Subject: [PATCH 2/6] accidentally removed >> dev/null --- scripts/prepare_instrumentation.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index 2432e969e6..832d6ce670 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -185,18 +185,18 @@ shopt -u extglob find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(unsigned long\)\1\)/" \{\} \; # run wmc_tool -"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" -"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" +"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" >> /dev/null +"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null # ISAR post-renderer and lc3plus sources only need to be instrumented in float code if [ "$PROJECT" = "FLOAT" ]; then cp -R ../lib_rend/*.c $targetdir/lib_rend # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null cp -R ../lib_lc3plus/*.c $targetdir/lib_lc3plus # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool cp -R ../lib_lc3plus/fft/*.c $targetdir/lib_lc3plus/fft # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null else cp -R ../lib_rend/*.c $targetdir/lib_rend # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> /dev/null fi # automatically enable #define WMOPS in options.h -- GitLab From ef53480d9b7105d3b087f01315802dbeb65058ea Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Mon, 9 Dec 2024 15:01:30 +0100 Subject: [PATCH 3/6] rename *.bak instead of copying fresh .c files --- scripts/prepare_instrumentation.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index 832d6ce670..4ed7098442 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -189,13 +189,13 @@ find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(u "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null # ISAR post-renderer and lc3plus sources only need to be instrumented in float code if [ "$PROJECT" = "FLOAT" ]; then - cp -R ../lib_rend/*.c $targetdir/lib_rend # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + for bak_file in $targetdir/lib_rend/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null - cp -R ../lib_lc3plus/*.c $targetdir/lib_lc3plus # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - cp -R ../lib_lc3plus/fft/*.c $targetdir/lib_lc3plus/fft # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + for bak_file in $targetdir/lib_lc3plus/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + for bak_file in $targetdir/lib_lc3plus/fft/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null else - cp -R ../lib_rend/*.c $targetdir/lib_rend # copy over fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + for bak_file in $targetdir/lib_rend/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> /dev/null fi -- GitLab From eb9213a5d4fb9490cae5eb729fe6bd660b256afe Mon Sep 17 00:00:00 2001 From: malenov Date: Tue, 10 Dec 2024 09:56:27 +0100 Subject: [PATCH 4/6] put {} in the empty-body 'for' loop to be properly instrumented --- lib_lc3plus/fft/cfft.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_lc3plus/fft/cfft.c b/lib_lc3plus/fft/cfft.c index 6ec89eb299..d796f0a213 100644 --- a/lib_lc3plus/fft/cfft.c +++ b/lib_lc3plus/fft/cfft.c @@ -126,13 +126,13 @@ static void scramble(LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT n, LC3_INT s) LC3_FLOAT tmp; LC3_INT m, k, j; - for (m = 1, j = 0; m < (n - 1); m++) { - { - for (k = n >> 1; (!((j ^= k) & k)); k >>= 1) - ; - } + for (m = 1, j = 0; m < (n - 1); m++) + { + for (k = n >> 1; (!((j ^= k) & k)); k >>= 1) + {} - if (j > m) { + if (j > m) + { tmp = re[s * m]; re[s * m] = re[s * j]; re[s * j] = tmp; -- GitLab From 091a5f5d2808b4f3f59b5f7be119b435d4e6fd90 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 11 Dec 2024 12:46:33 +0100 Subject: [PATCH 5/6] do not treat warnings as errors in instrumented build job --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 546c729556..c7ed779541 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -508,7 +508,6 @@ build-codec-instrumented-linux: timeout: "10 minutes" script: - *print-common-info - - *activate-Werror-linux - ./scripts/prepare_instrumentation.sh - make -j -C scripts/c-code_instrument -- GitLab From 5e68ab0a945b751c41074cbb3c78e61cb2091b30 Mon Sep 17 00:00:00 2001 From: malenovsky Date: Wed, 11 Dec 2024 12:05:54 +0000 Subject: [PATCH 6/6] Revert previous modification --- lib_lc3plus/fft/cfft.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_lc3plus/fft/cfft.c b/lib_lc3plus/fft/cfft.c index d796f0a213..6ec89eb299 100644 --- a/lib_lc3plus/fft/cfft.c +++ b/lib_lc3plus/fft/cfft.c @@ -126,13 +126,13 @@ static void scramble(LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT n, LC3_INT s) LC3_FLOAT tmp; LC3_INT m, k, j; - for (m = 1, j = 0; m < (n - 1); m++) - { - for (k = n >> 1; (!((j ^= k) & k)); k >>= 1) - {} - - if (j > m) + for (m = 1, j = 0; m < (n - 1); m++) { { + for (k = n >> 1; (!((j ^= k) & k)); k >>= 1) + ; + } + + if (j > m) { tmp = re[s * m]; re[s * m] = re[s * j]; re[s * j] = tmp; -- GitLab