automake-ng
[Top][All Lists]
Advanced

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

Re: [Automake-NG] [PATCH 4/4] [ng] cleanup: after enabling of subdir-obj


From: Akim Demaille
Subject: Re: [Automake-NG] [PATCH 4/4] [ng] cleanup: after enabling of subdir-objects unconditionally
Date: Fri, 8 Jun 2012 11:06:14 +0200

Le 8 juin 2012 à 10:29, Stefano Lattarini a écrit :

> Few minor cleanups made possible by earlier changes, plus other minor
> cleanups triggered in cascade.  No semantic change is intended.

There should be

* automake.in:

here.

> (LANG_IGNORE, LANG_SUBDIR): Remove.
> (register_language ('name' => 'vala', ...)): Add '.vapi' to the entry
> 'extensions', and simplify the entry 'output_extensions' to point to a
> dummy subroutine (since it wasn't really used anyway).
> (handle_single_transform): Don't expect the 'lang_*_rewrite' subroutines
> to return a 'LANG_*' constant anymore, but only a transformed extension,
> if required.  To decide whether further processing of the source file
> should be stopped, rely on a new set of 'lang_*_ignore' subroutines,
> defaulting to a subroutine that returns false.  Accordingly, don't special
> case the handling of '.vapi' files anymore, instead relying on ...
> (lang_vala_ignore, lang_header_ignore): ... these new subroutines to avoid
> extra processing of C/C++ headers and Vala '.vapi' headers.
> (lang_c_rewrite): Adjust to explicitly return an undefined value.
> (lang_java_rewrite): Remove.
> Remove an outdated comment.
> 
> Signed-off-by: Stefano Lattarini <address@hidden>
> ---
> automake.in |  100 +++++++++++++++++++++++------------------------------------
> 1 file changed, 39 insertions(+), 61 deletions(-)
> 
> diff --git a/automake.in b/automake.in
> index 14b328a..7d38465 100644
> --- a/automake.in
> +++ b/automake.in
> @@ -809,9 +802,9 @@ register_language ('name' => 'vala',
>                  'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
>                  'ccer' => 'VALAC',
>                  'compiler' => 'VALACOMPILE',
> -                'extensions' => ['.vala'],
> -                'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/;
> -                                             return ($ext,) },
> +                'extensions' => ['.vala', '.vapi'],
> +                   # Vala compilation must be handled in a special way.
> +                'output_extensions' => sub { return () },

Especially for small functions, I really don't see any point
in keeping "return".  Just { () } is fine.


> @@ -5068,11 +5057,6 @@ sub check_gnits_standards
> #
> # Functions to handle files of each language.
> 
> -# Each 'lang_X_rewrite($DIRECTORY, $BASE, $EXT)' function follows a
> -# simple formula: Return value is LANG_SUBDIR if the resulting object
> -# file should be in a subdir if the source file is, LANG_PROCESS if
> -# file is to be dealt with, LANG_IGNORE otherwise.
> -
> # Much of the actual processing is handled in
> # handle_single_transform.  These functions exist so that
> # auxiliary information can be recorded for a later cleanup pass.
> @@ -5105,33 +5089,34 @@ sub lang_c_rewrite
>                     uniq_part => 'AM_PROG_CC_C_O per-target');
>        }
>     }
> -
> -  return LANG_SUBDIR;
> +  return;

Pretty useless.

> }
> 
> -# Rewrite a single header file.
> -sub lang_header_rewrite
> +# Header files are simply ignored.
> +sub lang_header_ignore { return 1; }

{ 1; }

> +
> +# Vala '.vapi' are a kind of header files as well, and should
> +# not be processed into compilation rules.
> + sub lang_vala_ignore
> {
> -    # Header files are simply ignored.
> -    return LANG_IGNORE;
> +    my ($directory, $base, $ext) = @_;
> +    return ($ext =~ m/\.vapi$/ ? 1 : 0);

No return, no parens.  etc.

> }
> 
> # Rewrite a single Vala source file.
> sub lang_vala_rewrite
> {
>     my ($directory, $base, $ext) = @_;
> -
> -    (my $newext = $ext) =~ s/vala$/c/;
> -    return (LANG_SUBDIR, $newext);
> +    $ext =~ s/vala$/c/;
> +    return $ext;
> }
> 
> # Rewrite a single yacc/yacc++ file.
> sub lang_yacc_rewrite
> {
>     my ($directory, $base, $ext) = @_;
> -
> -    (my $newext = $ext) =~ tr/y/c/;
> -    return (LANG_SUBDIR, $newext);
> +    $ext =~ tr/y/c/;
> +    return $ext;
> }
> sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); };
> 
> @@ -5139,18 +5124,11 @@ sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); };
> sub lang_lex_rewrite
> {
>     my ($directory, $base, $ext) = @_;
> -
> -    (my $newext = $ext) =~ tr/l/c/;
> -    return (LANG_SUBDIR, $newext);
> +    $ext =~ tr/l/c/;
> +    return $ext;
> }
> sub lang_lexxx_rewrite { lang_lex_rewrite (@_); };
> 
> -# Rewrite a single Java file.
> -sub lang_java_rewrite
> -{
> -    return LANG_SUBDIR;
> -}
> -
> # The lang_X_finish functions are called after all source file
> # processing is done.  Each should handle defining rules for the
> # language, etc.  A finish function is only called if a source file of
> -- 
> 1.7.9.5
> 
> 




reply via email to

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