mirror of
https://github.com/AdaCore/PolyORB.git
synced 2026-02-12 13:01:15 -08:00
[Imported from Perforce change 10372 at 2006-12-01 22:54:59] Subversion-branch: /trunk/polyorb Subversion-revision: 37832
59 lines
1.5 KiB
Bash
Executable File
59 lines
1.5 KiB
Bash
Executable File
#! /bin/sh
|
|
# $Id$
|
|
|
|
# Change uses of pragma Debug to use the two-argument version of the pragma.
|
|
# This is supported in GNAT Pro 5.04a1, GNAT GPL 2006, but not in FSF GCC 4.1.
|
|
# When we move up our minimal FSF GCC version, we can commit this to main
|
|
# sources.
|
|
|
|
set -e
|
|
|
|
if [ $# -gt 1 ]; then
|
|
echo "Usage: $0 [<file>]"
|
|
exit 1
|
|
fi
|
|
|
|
if [ $# = 0 ]; then
|
|
marker="CONDITIONAL_PRAGMA_DEBUG_ENABLED"
|
|
trap "rm -f $marker.NEW" 0
|
|
|
|
if [ ! -f MANIFEST ]; then
|
|
echo "This script must be run from the top level source directory"
|
|
exit 1
|
|
fi
|
|
if [ -f "$marker" ]; then
|
|
echo "Conditional pragma Debug is already enabled"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Conditional pragma Debug is now enabled in:" > $marker.NEW
|
|
DOLIST='find src -type f -name "*.adb"'
|
|
else
|
|
DOLIST='echo "$1"'
|
|
fi
|
|
|
|
eval "$DOLIST" | while read f; do
|
|
rm -f "$f.new"
|
|
awk '
|
|
/pragma Debug/ { pragma_debug_seen = 1; }
|
|
pragma_debug_seen && /pragma Unreferenced/ {
|
|
sub (/pragma Unreferenced.*--/, "--");
|
|
pragma_debug_seen = 0;
|
|
}
|
|
pragma_debug_seen && /\(O1/ { sub (/\(O1/, "(C1, O1"); pragma_debug_seen = 0; }
|
|
pragma_debug_seen && /\(O2/ { sub (/\(O2/, "(C2, O2"); pragma_debug_seen = 0; }
|
|
pragma_debug_seen && /\(O/ { sub (/\(O/, "(C, O"); pragma_debug_seen = 0; }
|
|
pragma_debug_seen && /;/ { pragma_debug_seen = 0; }
|
|
{print}' < "$f" > "$f.new"
|
|
#awk '{if (length($0) > 79) { print NR; }}' < $f.new | sed "s,^,$f:,"
|
|
mv -f "$f.new" "$f"
|
|
if [ -f $marker.NEW ]; then
|
|
echo $f >> $marker.NEW
|
|
fi
|
|
done
|
|
|
|
if [ $# = 0 ]; then
|
|
echo "Conditional pragma Debug is now enabled"
|
|
mv $marker.NEW $marker
|
|
fi
|