[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Cwrapper should not eat -- arguments
From: |
Charles Wilson |
Subject: |
[PATCH] Cwrapper should not eat -- arguments |
Date: |
Sun, 25 May 2008 00:13:04 -0400 |
* libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src)
[file scope]: Defined all option strings in terms of macro
LTWRAPPER_OPTION_PREFIX. Similarly defined all option string
lengths in terms of macro LTWRAPPER_OPTION_PREFIX_LENGTH.
[main]: Modified option parsing algorithm to pass -- on to
target, and to not stop processing arguments when -- is seen.
Added check for unrecognized options in reserved namespace
defined by LTWRAPPER_OPTION_PREFIX.
---
As discussed here:
http://lists.gnu.org/archive/html/libtool-patches/2008-05/msg00067.html
Passes all but three tests on cygwin: the new-testsuite 25/72 that
we are used to, and one new failure: demo-exec after demo-shared.
It is interesting that this failure, long present on mingw, has now
shown up on cygwin. I traced it, and it is due to trying to populate
the lt__PROGRAM__LTX_preloaded_symbols[] array using an
'nm | $global_symbols_pipe' on a DLL, instead of a static library or
import library.
This is not a new failure, even on cygwin. It was *hidden* on cygwin
because the shell wrapper did not report a failure code in this case,
but the cwrapper does. In any case, that failure is neither a
regression, nor caused by this patch. I'll open another thread to
discuss it.
Ok to push?
Chuck
libltdl/config/ltmain.m4sh | 49 +++++++++++++++++++++++++------------------
1 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 0bfae76..888b74b 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -2841,18 +2841,24 @@ EOF
cat <<"EOF"
-static const char *dumpscript_opt = "--lt-dump-script";
+#define LTWRAPPER_OPTION_PREFIX "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH 5
-static const size_t env_set_opt_len = 12;
-static const char *env_set_opt = "--lt-env-set";
+static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
+static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX
"dump-script";
+
+static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
/* argument is putenv-style "foo=bar", value of foo is set to bar */
-static const size_t env_prepend_opt_len = 16;
-static const char *env_prepend_opt = "--lt-env-prepend";
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX
"env-prepend";
/* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
-static const size_t env_append_opt_len = 15;
-static const char *env_append_opt = "--lt-env-append";
+static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
/* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
int
@@ -2989,8 +2995,7 @@ EOF
lt_opt_process_env_set (p);
}
else if ((arglen == env_set_opt_len) &&
- (i + 1 < argc) &&
- (strcmp (argv[i + 1], "--") != 0))
+ (i + 1 < argc))
{
lt_opt_process_env_set (argv[i + 1]);
i++; /* don't copy */
@@ -3008,8 +3013,7 @@ EOF
lt_opt_process_env_prepend (p);
}
else if ((arglen == env_prepend_opt_len) &&
- (i + 1 < argc) &&
- (strcmp (argv[i + 1], "--") != 0))
+ (i + 1 < argc))
{
lt_opt_process_env_prepend (argv[i + 1]);
i++; /* don't copy */
@@ -3027,8 +3031,7 @@ EOF
lt_opt_process_env_append (p);
}
else if ((arglen == env_append_opt_len) &&
- (i + 1 < argc) &&
- (strcmp (argv[i + 1], "--") != 0))
+ (i + 1 < argc))
{
lt_opt_process_env_append (argv[i + 1]);
i++; /* don't copy */
@@ -3037,15 +3040,19 @@ EOF
lt_fatal ("%s missing required argument", env_append_opt);
continue;
}
- if (strcmp (argv[i], "--") == 0)
+ if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
{
- /* immediately copy all the rest of the arguments */
- ++i;
- for (; i < argc; i++)
- newargz[++newargc] = xstrdup (argv[i]);
-
- /* same as break, because i = argc */
- continue;
+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+ namespace, but it is not one of the ones we know about and
+ have already dealt with, above (inluding dump-script), then
+ report an error. Otherwise, targets might begin to believe
+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+ namespace. The first time any user complains about this, we'll
+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+ or a configure.ac-settable value.
+ */
+ lt_fatal ("Unrecognized option in %s namespace: '%s'",
+ ltwrapper_option_prefix, argv[i]);
}
/* otherwise ... */
newargz[++newargc] = xstrdup (argv[i]);
--
1.5.5.1
- [PATCH] Cwrapper should not eat -- arguments,
Charles Wilson <=
- Re: [PATCH] Cwrapper should not eat -- arguments, Ralf Wildenhues, 2008/05/25
- Re: [PATCH] Cwrapper should not eat -- arguments, Charles Wilson, 2008/05/25
- Re: [PATCH] Cwrapper should not eat -- arguments, Ralf Wildenhues, 2008/05/25
- Re: [PATCH] Cwrapper should not eat -- arguments, Charles Wilson, 2008/05/25
- Re: [PATCH] Cwrapper should not eat -- arguments, Charles Wilson, 2008/05/25
- Re: [PATCH] Cwrapper should not eat -- arguments, Ralf Wildenhues, 2008/05/26
- Re: [PATCH] Cwrapper should not eat -- arguments, Charles Wilson, 2008/05/26
- Re: [PATCH] Cwrapper should not eat -- arguments, Ralf Wildenhues, 2008/05/26
- Re: [PATCH] Cwrapper should not eat -- arguments, Charles Wilson, 2008/05/26
Re: [PATCH] Cwrapper should not eat -- arguments, Olly Betts, 2008/05/28