]> ruderich.org/simon Gitweb - blhc/blhc.git/blobdiff - bin/blhc
Abort with an error if no files are given.
[blhc/blhc.git] / bin / blhc
index 10b39f388c9b1769d3e308b2903a01524b2e6ddf..835e9e04e344cea2d96ffe44f5a4fc032343eb83 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -188,6 +188,26 @@ my @def_ldflags_pic = (
     '-fpic',
     '-shared',
 );
+# References to all flags checked by the parser.
+my @flag_refs = (
+    \@def_cflags,
+    \@def_cflags_format,
+    \@def_cflags_fortify,
+    \@def_cflags_stack,
+    \@def_cflags_pie,
+    \@def_cxxflags,
+    \@def_cppflags,
+    \@def_cppflags_fortify,
+    \@def_ldflags,
+    \@def_ldflags_relro,
+    \@def_ldflags_bindnow,
+);
+# References to all used flags.
+my @flag_refs_all = (
+    @flag_refs,
+    \@def_ldflags_pie,
+    \@def_ldflags_pic,
+);
 # Renaming rules for the output so the regex parts are not visible. Also
 # stores string values of flag regexps above, see compile_flag_regexp().
 my %flag_renames = (
@@ -421,7 +441,8 @@ if (not Getopt::Long::GetOptions(
             'color'    => \$option_color,
             'arch=s'   => \$option_arch,
             'buildd'   => \$option_buildd,
-        )) {
+        )
+        or scalar @ARGV == 0) {
     require Pod::Usage;
     Pod::Usage::pod2usage(2);
 }
@@ -461,19 +482,9 @@ if ($option_all) {
 
 # Precompile all flag regexps. any_flags_used(), all_flags_used() get a lot
 # faster with this.
-@def_cflags           = compile_flag_regexp(\%flag_renames, @def_cflags);
-@def_cflags_format    = compile_flag_regexp(\%flag_renames, @def_cflags_format);
-@def_cflags_fortify   = compile_flag_regexp(\%flag_renames, @def_cflags_fortify);
-@def_cflags_stack     = compile_flag_regexp(\%flag_renames, @def_cflags_stack);
-@def_cflags_pie       = compile_flag_regexp(\%flag_renames, @def_cflags_pie);
-@def_cxxflags         = compile_flag_regexp(\%flag_renames, @def_cxxflags);
-@def_cppflags         = compile_flag_regexp(\%flag_renames, @def_cppflags);
-@def_cppflags_fortify = compile_flag_regexp(\%flag_renames, @def_cppflags_fortify);
-@def_ldflags          = compile_flag_regexp(\%flag_renames, @def_ldflags);
-@def_ldflags_relro    = compile_flag_regexp(\%flag_renames, @def_ldflags_relro);
-@def_ldflags_bindnow  = compile_flag_regexp(\%flag_renames, @def_ldflags_bindnow);
-@def_ldflags_pie      = compile_flag_regexp(\%flag_renames, @def_ldflags_pie);
-@def_ldflags_pic      = compile_flag_regexp(\%flag_renames, @def_ldflags_pic);
+foreach my $flags (@flag_refs_all) {
+    @{$flags} = compile_flag_regexp(\%flag_renames, @{$flags});
+}
 
 # Final exit code.
 my $exit = 0;
@@ -954,9 +965,18 @@ changes are in effect:
 
 =item
 
+Print tags instead of normal warnings, see README file for a list of possible
+tags.
+
+=item
+
 Don't check hardening flags in old log files (if dpkg-dev << 1.16.1 is
 detected).
 
+=item
+
+Don't require Term::ANSIColor.
+
 =back
 
 =item B<--color>