libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

function definitions (was: [PATCH-2.0] 51-peter-func_extract_an_archive-


From: Ralf Wildenhues
Subject: function definitions (was: [PATCH-2.0] 51-peter-func_extract_an_archive-2.0.patch)
Date: Tue, 4 Jan 2005 17:57:42 +0100
User-agent: Mutt/1.4.1i

* Ralf Wildenhues wrote on Tue, Jan 04, 2005 at 09:35:06AM CET:
> 
> I noticed we are inconsistent w.r.t. function headers.  I like
> | func_foo ()
> | {
> |   # ...
> | }
> 
> better than
> | func_foo () {
> |   # ...
> | }
> 
> for aesthetic reasons and because my editor will find the function start
> in the first case.
> 
> If we can agree on this, I can follow up your patch with one that
> changes all functions to look like this (plus add a note to HACKING).
> No need for you to change your patch.

OK to apply the following to HEAD and branch-2-0 (after your patch)?
Is $as_cr_alnum exported interface of Autoconf?  Can we use it?

Thanks,
Ralf

        * tests/sh.test: Check for preferred function definition layout.
        * config/ltmain.m4sh (func_win32_libid, func_infer_tag,
        func_generate_dlsyms, func_extract_an_archive, func_extract_archives):
        adjust to fit.

Index: tests/sh.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/sh.test,v
retrieving revision 1.21
diff -u -r1.21 sh.test
--- tests/sh.test       28 Dec 2004 13:50:23 -0000      1.21
+++ tests/sh.test       4 Jan 2005 15:00:58 -0000
@@ -81,4 +81,18 @@
   status=$EXIT_FAILURE
 fi
 
+# Check for opening brace on next line in shell function definition
+for s in $scripts
+do
+  if $SED -n '/^func_/{N;/^func_['"$as_cr_alnum"'_]* ()\n{$/d;p;}' $s |
+     $EGREP .; then
+    echo "Function definitions should look like this in $s:
+func_foo ()
+{
+  # ...
+}"
+    status=$EXIT_FAILURE
+  fi
+done
+
 exit $status
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.39
diff -u -r1.39 ltmain.m4sh
--- config/ltmain.m4sh  28 Dec 2004 13:50:23 -0000      1.39
+++ config/ltmain.m4sh  4 Jan 2005 15:00:58 -0000
@@ -631,7 +631,8 @@
 # Need a lot of goo to handle *both* DLLs and import libs
 # Has to be a shell function in order to 'eat' the argument
 # that is supplied when $file_magic_command is called.
-func_win32_libid () {
+func_win32_libid ()
+{
   $opt_debug
   win32_libid_type="unknown"
   win32_fileres=`file -L $1 2>/dev/null`
@@ -673,7 +674,8 @@
 # Only attempt this if the compiler in the base compile
 # command doesn't match the default compiler.
 # arg is usually of the form 'gcc ...'
-func_infer_tag () {
+func_infer_tag ()
+{
     $opt_debug
     if test -n "$available_tags" && test -z "$tagname"; then
       CC_quoted=
@@ -728,7 +730,8 @@
 # func_generate_dlsyms outputname originator pic_p
 # Extract symbols from dlprefiles and create ${outputname}S.o with
 # a dlpreopen symbol table.
-func_generate_dlsyms () {
+func_generate_dlsyms ()
+{
     $opt_debug
     my_outputname="$1"
     my_originator="$2"
@@ -970,7 +973,8 @@
 }
 
 # func_extract_an_archive dir oldlib
-func_extract_an_archive () {
+func_extract_an_archive ()
+{
     $opt_debug
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
@@ -1007,7 +1011,8 @@
 
 
 # func_extract_archives gentop oldlib ...
-func_extract_archives () {
+func_extract_archives ()
+{
     $opt_debug
     my_gentop="$1"; shift
     my_oldlibs=${1+"$@"}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]