One of the awk scripts used during the Open64 build currently requires
a GNU extension.  On Ubuntu 10.10, the default awk program is mawk
rather than gawk as on most other systems.  With mawk the script fails
and prevents the Fortran FE from building.

To make things a little easier, I propose the following patch that
changes the script to use only traditional awk features.  The output
of the script is identical.

With the patch applied, I am able to build from source on Ubuntu 10.10
without the added step of changing the default awk program.

Suneel, let me know if you think this change should go into the
release.  Thanks,

-David Coakley / AMD Open Source Compiler Engineering


Index: osprey/libu/errmsg/extract.awk
===================================================================
--- osprey/libu/errmsg/extract.awk      (revision 3521)
+++ osprey/libu/errmsg/extract.awk      (working copy)
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2009 Advanced Micro Devices, Inc.  All Rights Reserved.
+#  Copyright (C) 2009, 2011 Advanced Micro Devices, Inc.  All Rights Reserved.
 #
 #  This program is free software; you can redistribute it and/or modify it
 #  under the terms of the GNU Lesser General Public License as published
@@ -32,19 +32,24 @@
     printf "\tchar *msg;\n";
     printf "} libu_default_msgs[] = {\n";
 }
-{
-    # note: using gawk extension to set 'result'
-    if (match($0, /^\$msg ([0-9]+) (.+)$/, result)) {
-        if (count > 0) {
-            printf ",\n";
-        }
-        count++;
+/^\$msg ([0-9]+) (.+)$/ {
+    if (count > 0) {
+        printf ",\n";
+    }
+    count++;

-        # escape double-quotes in message text
-        msg = result[2];
-        gsub(/"/, "\\\"", msg)
-        printf "\t{ %s, \"%s\" }", result[1], msg
-    }
+    # the message number is the text between the first and second spaces
+    sp1 = index($0, " ")
+    sp2 = sp1 + index(substr($0, sp1 + 1), " ")
+    num = substr($0, sp1 + 1, sp2 - sp1 - 1)
+
+    # the message is the remainder following the second space in the line
+    msg = substr($0, sp2 + 1)
+
+    # escape double-quotes in message text
+    gsub(/"/, "\\\"", msg)
+
+    printf "\t{ %s, \"%s\" }", num, msg
 }
 END {
     printf "\n};\n";

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to