forked from ethz-asl/gtsam_catkin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
disable_warnings.sh
executable file
·34 lines (29 loc) · 1.35 KB
/
disable_warnings.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#schneith, 10/2014
#!/bin/bash
# Check for arguments
if [ -z "$1" ]; then
echo "Disable the warnings generated by the gtsam headers by adding pragma's to all header files.";
echo -e "Usage: disable_warnings.sh CATKIN_DEVEL_SPACE"
exit -1
fi
DEVEL_SPACE=$1
GTSAM_INCLUDES_DIR=$1/include/gtsam
pushd $(dirname $0) > /dev/null
TEMPLATE_DIR=$(pwd -P)/templates
popd > /dev/null
# Now check if gtsam headers are installed and the path is correct
if [ ! -d "$GTSAM_INCLUDES_DIR" ] || [ ! -f "$GTSAM_INCLUDES_DIR/config.h" ]; then
echo "Could not find gtsam headers in the specified devel space!";
exit -1
fi
# Check wheter the warnings are already disabled
ALREADY_IGNORED=$(cat $GTSAM_INCLUDES_DIR/config.h | grep "pragma GCC diagnostic ignored \"-Wunused-parameter\"" | wc -l)
if [ "$ALREADY_IGNORED" -eq "1" ]; then
echo "Warnings are already disabled, you only need to run this script once!";
echo "To revert to the original state you can clean and rebuild the gtsam_catkin package.";
exit -1
fi
# Now recursivly add the header and footer to the headers
find $GTSAM_INCLUDES_DIR -name "*.h" -print0 | xargs -0 -I file sh -c "cat $TEMPLATE_DIR/header file $TEMPLATE_DIR/footer > file.new; mv file.new file"
echo "Successfully modified headers to disable the warnings."
echo "To revert to the original state you can clean and rebuild the gtsam_catkin package.";