File: 0011-libtool-optimizing-options-parser-hooks.patch

package info (click to toggle)
libtool 2.5.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,688 kB
  • sloc: sh: 58,532; ansic: 4,292; makefile: 883
file content (73 lines) | stat: -rw-r--r-- 2,721 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
From 16dbc070d32e6d4601cb5878dfdf69f2e29c84e1 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Mon, 5 Oct 2015 13:16:08 +0200
Subject: [PATCH] libtool: optimizing options-parser hooks

Its not necessary to (re)func_quote_for_eval in each function in
the hook hierarchy.  Usually it is enough if the leaf function
does func_quote_for_eval and its caller just re-uses the
<CALLEE>_return variable.

This is follow up for the previous commit.

* gl/build-aux/options-parser (func_run_hooks): Propagate
$EXIT_SUCCESS return code down to caller if *any* hook succeeded.
Never re-quote the result -- either the arguments are left
untouched, or the options have already been properly quoted by
succeeding hooks.
(func_parse_options): Quote '$@' and return $EXIT_SUCCESS only if
we changed something.
(func_validate_options): Likewise.
(func_options_prep): Likewise.
(func_options_finish): New hook-caller for 'func_options' hooks.
(func_options): Propagate return value down to top-level caller,
but pay attention we have always set $func_options_result.
* build-aux/ltmain.in (libtool_options_prep): Quote '$@' and
return $EXIT_SUCCESS only if we changed something.
(libtool_parse_options): Likewise.
* bootstrap: Sync gl/build-aux/with option-parser.
---
 bootstrap                   | 171 +++++++++++++++++++++++++++++++-------------
 build-aux/ltmain.in         |  35 ++++++---
 gl/build-aux/options-parser | 171 +++++++++++++++++++++++++++++++-------------
 3 files changed, 271 insertions(+), 106 deletions(-)

Index: libtool-2.5.4/bootstrap
===================================================================
--- libtool-2.5.4.orig/bootstrap
+++ libtool-2.5.4/bootstrap
@@ -1819,6 +1819,8 @@ func_add_hook ()
 {
     $debug_cmd
 
+    _G_rc_run_hooks=false
+
     case " $hookable_fns " in
       *" $1 "*) ;;
       *) func_fatal_error "'$1' does not accept hook functions." ;;
Index: libtool-2.5.4/build-aux/ltmain.in
===================================================================
--- libtool-2.5.4.orig/build-aux/ltmain.in
+++ libtool-2.5.4/build-aux/ltmain.in
@@ -378,6 +378,8 @@ libtool_options_prep ()
 
     _G_rc_lt_options_prep=:
 
+    _G_rc_lt_options_prep=:
+
     # Shorthand for --mode=foo, only valid as the first argument
     case $1 in
     clean|clea|cle|cl)
Index: libtool-2.5.4/build-aux/options-parser
===================================================================
--- libtool-2.5.4.orig/build-aux/options-parser
+++ libtool-2.5.4/build-aux/options-parser
@@ -176,6 +176,8 @@ func_run_hooks ()
 {
     $debug_cmd
 
+    _G_rc_run_hooks=false
+
     case " $hookable_fns " in
       *" $1 "*) ;;
       *) func_fatal_error "'$1' does not support hook functions." ;;