Commit | Line | Data |
---|---|---|
c4a9e8b4 TT |
1 | #!/bin/sh |
2 | # Copyright 2011, 2013 Free Software Foundation, Inc. | |
3 | # | |
4 | # This is free software: you can redistribute it and/or modify it | |
5 | # under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, but | |
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | # General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program. If not, see | |
16 | # <http://www.gnu.org/licenses/>. | |
17 | ||
18 | # You must set PYTHON_PLUGIN in the environment. | |
19 | # It should be the directory holding the "python.so" file. | |
af83e3f8 TT |
20 | # Usage: gcc-with-excheck [-Xx|-Xc] [--] ARGS |
21 | # -Xx means to invoke the exception checker. | |
22 | # -Xc means to invoke the cleanup checker. | |
23 | # -- means stop processing -X options. | |
24 | # ARGS are passed to gcc. | |
c4a9e8b4 | 25 | |
af83e3f8 | 26 | GCC=${GCC:-gcc} |
c4a9e8b4 TT |
27 | exdir=`dirname $0` |
28 | ||
af83e3f8 TT |
29 | pargs= |
30 | while true; do | |
31 | case "$1" in | |
32 | -Xc) | |
33 | pargs="$pargs -fplugin-arg-python-script=$exdir/cleanup_check.py" | |
34 | ;; | |
35 | -Xx) | |
36 | pargs="$pargs -fplugin-arg-python-script=$exdir/excheck.py" | |
37 | ;; | |
38 | -X*) | |
39 | echo "unrecognized argument $1" 1>&2 | |
40 | exit 1 | |
41 | ;; | |
42 | --) | |
43 | shift | |
44 | break | |
45 | ;; | |
46 | *) | |
47 | break | |
48 | ;; | |
49 | esac | |
50 | shift | |
51 | done | |
52 | ||
c4a9e8b4 TT |
53 | # Recent versions of the Python plugin build two .so files in |
54 | # different directories, so we have to set this. This will be fixed | |
55 | # upstream at some point. | |
56 | export LD_LIBRARY_PATH=$PYTHON_PLUGIN:$PYTHON_PLUGIN/gcc-c-api | |
57 | ||
af83e3f8 | 58 | gcc -fplugin=$PYTHON_PLUGIN/python.so $pargs "$@" |