From 48b6a125ca531b6dfc7a9082757c4b876fdb0202 Mon Sep 17 00:00:00 2001 From: Peter Waegemann <waegemann@cs.fau.de> Date: Wed, 6 Apr 2016 09:06:27 +0200 Subject: [PATCH] Workaround for adding inline attribute --- script/add_noinline_annotation.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/script/add_noinline_annotation.sh b/script/add_noinline_annotation.sh index fbbb0d0..ba684b6 100755 --- a/script/add_noinline_annotation.sh +++ b/script/add_noinline_annotation.sh @@ -9,18 +9,26 @@ TACLE_ROOT=$1 for i in $(grep -r "entrypoint" `find $TACLE_ROOT -name "*.c"` | cut -d: -f1) ; do + + #TODO # ugly workaround: run clang-format prior to the annotiation # to have { at the end of the line temp=$(tempfile) + # 1.) remove all comments + # to avoid main() /* long multi-line comment... */ { + # since clang-format will not move the '{' directly after the signature + sed -r ':a; s%(.*)/\*.*\*/%\1%; ta; /\/\*/ !b; N; ba' $i > $temp + mv $temp $i + + # 2. format clang-format $i > $temp mv $temp $i exists=$(grep -c '__attribute__((noinline))' $i ) if [ $exists -eq 0 ]; then - echo "annotating $i" # get the line number: line=$(grep -n "entrypoint" $i |cut -d: -f1) - echo "found in line $line" + echo "Annotated $i in line $line" sed -i "${line}s/{/__attribute__((noinline)){/g" $i fi done -- GitLab