linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgcc: Fix preprocessing of assembler files
@ 2014-01-04 10:20 Stefan Weil
  2014-01-04 10:57 ` Josh Triplett
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2014-01-04 10:20 UTC (permalink / raw)
  To: linux-sparse; +Cc: Stefan Weil

The old code does not preprocess assembler files when cgcc is called like
this:

cgcc -E -o multiboot.asm multiboot.S

As the preprocessor is not called, no multiboot.asm is generated, and any
further build steps which need it will fail.

Fix this by using a new intermediate variable $do_preprocess.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

This patch allows using cgcc for QEMU builds. I did not run any other tests,
so please review carefully.

Thanks,
Stefan Weil

 cgcc |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/cgcc b/cgcc
index c075e5f..a43e074 100755
--- a/cgcc
+++ b/cgcc
@@ -10,6 +10,7 @@ my $has_specs = 0;
 my $gendeps = 0;
 my $do_check = 0;
 my $do_compile = 1;
+my $do_preprocess = 0;
 my $gcc_base_dir;
 my $verbose = 0;
 
@@ -44,8 +45,7 @@ while (@ARGV) {
         next;
     }
 
-    # If someone adds "-E", don't pre-process twice.
-    $do_compile = 0 if $_ eq '-E';
+    $do_preprocess = 1 if $_ eq '-E';
 
     $verbose = 1 if $_ eq '-v';
 
@@ -59,6 +59,11 @@ if ($gendeps) {
     $do_check = 0;
 }
 
+if ($do_check && $do_preprocess) {
+    # If someone adds "-E", don't pre-process twice.
+    $do_compile = 0;
+}
+
 if ($do_check) {
     if (!$has_specs) {
 	$check .= &add_specs ('host_arch_specs');
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cgcc: Fix preprocessing of assembler files
  2014-01-04 10:20 [PATCH] cgcc: Fix preprocessing of assembler files Stefan Weil
@ 2014-01-04 10:57 ` Josh Triplett
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Triplett @ 2014-01-04 10:57 UTC (permalink / raw)
  To: Stefan Weil; +Cc: linux-sparse

On Sat, Jan 04, 2014 at 11:20:48AM +0100, Stefan Weil wrote:
> The old code does not preprocess assembler files when cgcc is called like
> this:
> 
> cgcc -E -o multiboot.asm multiboot.S
> 
> As the preprocessor is not called, no multiboot.asm is generated, and any
> further build steps which need it will fail.
> 
> Fix this by using a new intermediate variable $do_preprocess.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

Seems reasonable.
Reviewed-by: Josh Triplett <josh@joshtriplett.org>

> 
> This patch allows using cgcc for QEMU builds. I did not run any other tests,
> so please review carefully.
> 
> Thanks,
> Stefan Weil
> 
>  cgcc |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/cgcc b/cgcc
> index c075e5f..a43e074 100755
> --- a/cgcc
> +++ b/cgcc
> @@ -10,6 +10,7 @@ my $has_specs = 0;
>  my $gendeps = 0;
>  my $do_check = 0;
>  my $do_compile = 1;
> +my $do_preprocess = 0;
>  my $gcc_base_dir;
>  my $verbose = 0;
>  
> @@ -44,8 +45,7 @@ while (@ARGV) {
>          next;
>      }
>  
> -    # If someone adds "-E", don't pre-process twice.
> -    $do_compile = 0 if $_ eq '-E';
> +    $do_preprocess = 1 if $_ eq '-E';
>  
>      $verbose = 1 if $_ eq '-v';
>  
> @@ -59,6 +59,11 @@ if ($gendeps) {
>      $do_check = 0;
>  }
>  
> +if ($do_check && $do_preprocess) {
> +    # If someone adds "-E", don't pre-process twice.
> +    $do_compile = 0;
> +}
> +
>  if ($do_check) {
>      if (!$has_specs) {
>  	$check .= &add_specs ('host_arch_specs');
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-04 10:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-04 10:20 [PATCH] cgcc: Fix preprocessing of assembler files Stefan Weil
2014-01-04 10:57 ` Josh Triplett

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).