diff mbox

Hurd: Make gdb/reply_mig_hack.awk script compatible to "mawk" (was: [RFC] GDB Hurd Fixes)

Message ID 87a8ob57ne.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge Jan. 12, 2016, 12:01 p.m. UTC
Hi!

On Mon, 6 Jan 2014 17:56:27 +0100, I wrote:
> On Fri, 20 Sep 2013 11:17:08 -0400, David Michael <fedora.dm0@gmail.com> wrote:
> > mig has stopped using the "auto" keyword in its output.[1]
> > Without that keyword, gdb/reply_mig_hack.awk fails to match a
> > necessary pattern and outputs a bad gdb/process_reply_S.c file.

> commit d8131897afba28934ced82c507114123027a40f8
> Author: Thomas Schwinge <thomas@codesourcery.com>
> Date:   Mon Jan 6 15:56:33 2014 +0100
> 
>     Hurd: Adapt to changed MIG output.
>     
>     	gdb/
>     	* reply_mig_hack.awk: Don't expect to see the auto keyword.
>     
>     Based on patch by David Michael <fedora.dm0@gmail.com>.
> 
> diff --git gdb/reply_mig_hack.awk gdb/reply_mig_hack.awk
> index 97e080f..e137a27 100644
> --- gdb/reply_mig_hack.awk
> +++ gdb/reply_mig_hack.awk
> @@ -78,9 +78,9 @@ parse_phase == 4 {
>    print; next;
>  }
>  
> -parse_phase == 5 && /^[ \t]*(auto|static) const mach_msg_type_t/ {
> +parse_phase == 5 && /^[ \t]*(auto |static |)const mach_msg_type_t/ {
>    # The type check structure for an argument.
> -  arg_check_name[num_checks] = $4;
> +  arg_check_name[num_checks] = $(NF - 2);
>    num_checks++;
>    print; next;
>  }

Turns out that the "mawk" AWK implementation doesn't like that regular
expression:

    mawk: [...]/gdb/reply_mig_hack.awk: line 98: regular expression compile failed (missing operand)

I didn't check it against the AWK language definition, but instead just
made the gdb/reply_mig_hack.awk script compatible to "mawk"; pushed:

commit 5eddd57823971bdb54f957d10c11ff3fc9f97b1e
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Jan 12 12:53:09 2016 +0100

    Hurd: Make gdb/reply_mig_hack.awk script compatible to "mawk"
    
    The "mawk" AWK implementation did't like that regular expression:
    
        mawk: [...]/gdb/reply_mig_hack.awk: line 98: regular expression compile failed (missing operand)
    
    	gdb/
    	* reply_mig_hack.awk: Rewrite one regular expression.
---
 gdb/ChangeLog          | 4 ++++
 gdb/reply_mig_hack.awk | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)



Grüße
 Thomas
diff mbox

Patch

diff --git gdb/ChangeLog gdb/ChangeLog
index 099a9a9..73b001c 100644
--- gdb/ChangeLog
+++ gdb/ChangeLog
@@ -1,3 +1,7 @@ 
+2016-01-12  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* reply_mig_hack.awk: Rewrite one regular expression.
+
 2016-01-11  Mike Frysinger  <vapier@gentoo.org>
 
 	* acinclude.m4: Include new warning.m4 file.
diff --git gdb/reply_mig_hack.awk gdb/reply_mig_hack.awk
index 1e2387a..e4c513b 100644
--- gdb/reply_mig_hack.awk
+++ gdb/reply_mig_hack.awk
@@ -95,7 +95,7 @@  parse_phase == 4 {
   print; next;
 }
 
-parse_phase == 5 && /^[ \t]*(auto |static |)const mach_msg_type_t/ {
+parse_phase == 5 && /^[ \t]*(auto |static )?const mach_msg_type_t/ {
   # The type check structure for an argument.
   arg_check_name[num_checks] = $(NF - 2);
   num_checks++;