From: Alexey zaytsev <alexey.zaytsev@gmail.com>
To: Josh Triplett <josh@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-sparse@vger.kernel.org, Sam Ravnborg <sam@ravnborg.org>,
Josh Triplett <josh@freedesktop.org>
Subject: [PATCH 2/4] Let cgcc pass -gcc-base-dir to sparse.
Date: Mon, 08 Dec 2008 12:20:48 +0300 [thread overview]
Message-ID: <20081208092048.15890.82300.stgit@xl0.local> (raw)
In-Reply-To: <20081208091817.15890.27981.stgit@xl0.local>
---
cgcc | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/cgcc b/cgcc
index 89adbed..b59f7d6 100755
--- a/cgcc
+++ b/cgcc
@@ -10,9 +10,11 @@ my $has_specs = 0;
my $gendeps = 0;
my $do_check = 0;
my $do_compile = 1;
+my $gcc_base_dir;
my $verbose = 0;
-foreach (@ARGV) {
+while (@ARGV) {
+ $_ = shift(@ARGV);
# Look for a .c file. We don't want to run the checker on .o or .so files
# in the link run. (This simplistic check knows nothing about options
# with arguments, but it seems to do the job.)
@@ -36,6 +38,12 @@ foreach (@ARGV) {
next;
}
+ if (/^-gcc-base-dir$/) {
+ $gcc_base_dir = shift @ARGV;
+ die ("$0: missing argument for -gcc-base-dir option") if !$gcc_base_dir;
+ next;
+ }
+
# If someone adds "-E", don't pre-process twice.
$do_compile = 0 if $_ eq '-E';
@@ -56,6 +64,10 @@ if ($do_check) {
$check .= &add_specs ('host_arch_specs');
$check .= &add_specs ('host_os_specs');
}
+
+ $gcc_base_dir = qx($cc -print-file-name=) if !$gcc_base_dir;
+ $check .= " -gcc-base-dir " . $gcc_base_dir if $gcc_base_dir;
+
print "$check\n" if $verbose;
if ($do_compile) {
system ($check);
next prev parent reply other threads:[~2008-12-08 9:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-08 9:20 [PATCH 0/4] Proper gcc header dir handling in sparse Alexey zaytsev
2008-12-08 9:20 ` [PATCH 1/4] Set gcc include path at runtime Alexey zaytsev
2008-12-09 10:08 ` Christoph Hellwig
2008-12-08 9:20 ` Alexey zaytsev [this message]
2008-12-08 9:20 ` [PATCH 3/4] Document -gcc-base-dir in sparse.1 Alexey zaytsev
2008-12-08 9:21 ` [PATCH 4/4] Rename dirafter to idirafter Alexey zaytsev
2008-12-15 21:07 ` Sam Ravnborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081208092048.15890.82300.stgit@xl0.local \
--to=alexey.zaytsev@gmail.com \
--cc=hch@infradead.org \
--cc=josh@freedesktop.org \
--cc=josh@kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).