libtool-patches
[Top][All Lists]
Advanced

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

FYI: function definitions


From: Ralf Wildenhues
Subject: FYI: function definitions
Date: Tue, 1 Feb 2005 08:35:54 +0100
User-agent: Mutt/1.4.1i

* Gary V. Vaughan wrote on Mon, Jan 10, 2005 at 12:27:44PM CET:
> Ralf Wildenhues wrote:
> >     * 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.
> 
> Agreed.  Please add a note to HACKING too.

Good idea.

> Pending the status of $as_cr_alnum, please go ahead.

I just realized that, if I first need Autoconf to have a macro that
guarantees to provide as_cr_alnum, then we can't use it anyway until
the next stable Autoconf is released.

So I decided to apply the following to HEAD and branch-2-0,
in branch-1-5 I merely moved the braces.

The sh.test test will be added eventually.

Regards,
Ralf

        * HACKING (Editing `.m4sh' Files): Document preferred function
        header layout.
        * config/ltmain.m4sh (func_win32_libid, func_infer_tag)
        (func_generate_dlsyms, func_extract_an_archive, func_extract_archives):
        adjust to fit.

Index: HACKING
===================================================================
RCS file: /cvsroot/libtool/libtool/HACKING,v
retrieving revision 1.11
diff -u -r1.11 HACKING
--- HACKING     9 Jan 2005 13:33:19 -0000       1.11
+++ HACKING     1 Feb 2005 07:32:08 -0000
@@ -200,7 +200,19 @@
   variable names.  Don't use `return', instead echo the result of a
   function and call it from within backquotes.
 
-* Function names should be prefixed `func_'.
+* Function names should be prefixed `func_', the function header should
+  look like this:
+
+  # func_foo [ OPTIONS ]
+  # Description of what func_foo does and returns.
+  func_foo ()
+  {
+      $opt_debug
+      # contents of func_foo ...
+  }
+
+  The `$opt_debug' is used to enable shell tracing (Korn shells reset
+  this on function entry).
 
 * For functions that are called frequently, if you need to return a
   value, don't cause unneccessary forking of the shell using echo as
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.48
diff -u -r1.48 ltmain.m4sh
--- config/ltmain.m4sh  31 Jan 2005 16:17:06 -0000      1.48
+++ config/ltmain.m4sh  1 Feb 2005 07:32:08 -0000
@@ -636,7 +636,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`
@@ -678,7 +679,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=
@@ -733,7 +735,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"
@@ -975,7 +978,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"
@@ -1012,7 +1016,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]