[svn:parrot] r44358 - trunk/tools/dev

plobsing at svn.parrot.org plobsing at svn.parrot.org
Tue Feb 23 02:43:00 UTC 2010


Author: plobsing
Date: Tue Feb 23 02:42:59 2010
New Revision: 44358
URL: https://trac.parrot.org/parrot/changeset/44358

Log:
Add --no-warn-dups option to silence warning about duplicate signatures.

Modified:
   trunk/tools/dev/nci_thunk_gen.pir

Modified: trunk/tools/dev/nci_thunk_gen.pir
==============================================================================
--- trunk/tools/dev/nci_thunk_gen.pir	Tue Feb 23 02:21:08 2010	(r44357)
+++ trunk/tools/dev/nci_thunk_gen.pir	Tue Feb 23 02:42:59 2010	(r44358)
@@ -28,7 +28,7 @@
 
 .macro_const VERSION 0.01
 
-.macro_const OPTS_GLOBAL_NAME       'options'
+.macro_const OPTS_GLOBAL_NAME 'options'
 
 .sub 'main' :main
     .param pmc argv
@@ -108,6 +108,7 @@
 .macro_const LOADER_STORAGE_CLASS   'loader-storage-class'
 .macro_const LOADER_NAME            'loader-name'
 .macro_const CORE                   'core'
+.macro_const NO_WARN_DUPS           'no-warn-dups'
 
 .sub 'get_options'
     .param pmc argv
@@ -118,6 +119,7 @@
     getopt = new ['Getopt';'Obj']
     push getopt, 'help|h'
     push getopt, 'version|v'
+    push getopt, 'no-warn-dups|f'
     push getopt, 'core'
     push getopt, 'dynext'
     push getopt, 'output|o=s'
@@ -163,10 +165,14 @@
 Options
     --help              print this message and exit
     --version           print the version number of this utility
+    -f --no-warn-dups   don't complain about duplicated signatures. Default is to warn.
     --core              output a thunks file suitable for inclusion in Parrot core. Default is no.
+    --dynext            use default values for loader-name, loader-storage-class, and target
+                        suitable for use in a Parrot dynext library.
     -o --output <file>  specify output file to use.
     --target <target>   select what to output (valid options are 'head', 'thunks',
-                        'loader', 'coda', 'all', 'names', and 'signatures'). Default value is 'all'
+                        'loader', 'loader-dynext', 'coda', 'all', 'all-dynext', 'names', and
+                        'signatures'). Default value is 'all'
     --thunk-storage-class <storage class>
                         set the storage class used for the thunks. Default value is 'static'.
     --thunk-name-proto <printf prototype>
@@ -174,7 +180,8 @@
                         format with arity 1. Default value is 'pcf_%s'
     --loader-storage-class
                         set the storage class used for the loader function. Default value is none.
-    --loader-name       set the name used for the loader function. Default value is 'Parrot_load_nci_thunks'.
+    --loader-name       set the name used for the loader function. Default value is
+                        'Parrot_load_nci_thunks'.
 USAGE
     exit 0
 .end
@@ -190,6 +197,11 @@
 .sub 'fixup_opts'
     .param pmc opts
 
+    $I0 = defined opts['no-warn-dups']
+    if $I0 goto end_no_warn_dups
+        opts['no-warn-dups'] = ''
+    end_no_warn_dups:
+
     $I0 = defined opts['core']
     if $I0 goto in_core
         opts['core'] = ''
@@ -697,6 +709,9 @@
     seen  = new ['Hash']
     sigs  = new ['ResizablePMCArray']
 
+    .local int no_warn_dups
+    no_warn_dups = 'read_from_opts'(.NO_WARN_DUPS)
+
     .local int lineno
     lineno = 0
     read_loop:
@@ -713,8 +728,12 @@
         # de-dup sigs
         $I0 = seen[full_sig]
         unless $I0 goto unseen
-            $S0 = 'sprintf'("Ignored signature '%s' on line %d (previously seen on line %d)\n", full_sig, lineno, $I0)
-            printerr $S0
+            if no_warn_dups goto end_dup_warn
+                $S0 = 'sprintf'(<<'ERROR', full_sig, lineno, $I0)
+Ignored signature '%s' on line %d (previously seen on line %d)
+ERROR
+                printerr $S0
+            end_dup_warn:
             goto read_loop
         unseen:
         seen[full_sig] = lineno


More information about the parrot-commits mailing list