From a54f160b3a98b91cd241a555d904a6b6453affc4 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 25 Feb 2021 11:31:42 +0100 Subject: [PATCH] Prefer /usr/bin/env xxx over /usr/bin/xxx where xxx = perl, python, awk Allow users to use a non-system version of perl, python and awk, which is useful in certain package managers. Reviewed By: JDevlieghere, MaskRay Differential Revision: https://reviews.llvm.org/D95119 --- clang/test/make_test_dirs.pl | 3 ++- clang/tools/scan-build/bin/set-xcode-analyzer | 2 +- clang/utils/TestUtils/pch-test.pl | 3 ++- clang/utils/analyzer/reducer.pl | 6 ++++-- clang/utils/analyzer/update_plist_test.pl | 3 ++- clang/www/demo/index.cgi | 3 ++- debuginfo-tests/llgdb-tests/test_debuginfo.pl | 2 +- lldb/docs/use/python-reference.rst | 4 ++-- lldb/scripts/disasm-gdb-remote.pl | 2 +- llvm/utils/GenLibDeps.pl | 2 +- llvm/utils/codegen-diff | 2 +- llvm/utils/findsym.pl | 4 +++- llvm/utils/llvm-compilers-check | 2 +- llvm/utils/llvm-native-gxx | 2 +- openmp/runtime/tools/check-execstack.pl | 2 +- openmp/runtime/tools/check-instruction-set.pl | 2 +- openmp/runtime/tools/message-converter.pl | 2 +- polly/lib/External/isl/doc/mypod2latex | 2 +- 18 files changed, 28 insertions(+), 20 deletions(-) diff --git a/clang/test/make_test_dirs.pl b/clang/test/make_test_dirs.pl index 3a524d2adb1b..c2af9c485f93 100755 --- a/clang/test/make_test_dirs.pl +++ b/clang/test/make_test_dirs.pl @@ -1,9 +1,10 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # # Simple little Perl script that takes the cxx-sections.data file as # input and generates a directory structure that mimics the standard's # structure. use English; +use warnings; $current_indent_level = -4; while ($line = ) { diff --git a/clang/tools/scan-build/bin/set-xcode-analyzer b/clang/tools/scan-build/bin/set-xcode-analyzer index 9faaec1e8e6e..f8c3f775ef7d 100755 --- a/clang/tools/scan-build/bin/set-xcode-analyzer +++ b/clang/tools/scan-build/bin/set-xcode-analyzer @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # [PR 11661] Note that we hardwire to /usr/bin/python because we # want to the use the system version of Python on Mac OS X. diff --git a/clang/utils/TestUtils/pch-test.pl b/clang/utils/TestUtils/pch-test.pl index e4311e965bb7..cff8255b85a3 100755 --- a/clang/utils/TestUtils/pch-test.pl +++ b/clang/utils/TestUtils/pch-test.pl @@ -1,10 +1,11 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # This tiny little script, which should be run from the clang # directory (with clang in your patch), tries to take each # compilable Clang test and build a PCH file from that test, then read # and dump the contents of the PCH file just created. use POSIX; +use warnings; $exitcode = 0; sub testfiles($$) { diff --git a/clang/utils/analyzer/reducer.pl b/clang/utils/analyzer/reducer.pl index 872f61b33a77..75c0bf6ce7a6 100755 --- a/clang/utils/analyzer/reducer.pl +++ b/clang/utils/analyzer/reducer.pl @@ -1,5 +1,6 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl use strict; +use warnings; use File::Temp qw/ tempdir /; my $prog = "reducer"; @@ -31,8 +32,9 @@ push @$command, $srcFile; my $commandStr = "@$command"; print OUT < # +use warnings; + # Give first option a name. my $Directory = $ARGV[0]; my $Symbol = $ARGV[1]; diff --git a/llvm/utils/llvm-compilers-check b/llvm/utils/llvm-compilers-check index 33331fd0b93b..3b132454d20b 100755 --- a/llvm/utils/llvm-compilers-check +++ b/llvm/utils/llvm-compilers-check @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 ##===- utils/llvmbuild - Build the LLVM project ----------------*-python-*-===## # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/llvm/utils/llvm-native-gxx b/llvm/utils/llvm-native-gxx index db547f654e2f..3c8a703b5b63 100755 --- a/llvm/utils/llvm-native-gxx +++ b/llvm/utils/llvm-native-gxx @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Wrapper around LLVM tools to generate a native .o from llvm-gxx using an # LLVM back-end (CBE by default). diff --git a/openmp/runtime/tools/check-execstack.pl b/openmp/runtime/tools/check-execstack.pl index e4a8e7c883ab..7a710072f972 100755 --- a/openmp/runtime/tools/check-execstack.pl +++ b/openmp/runtime/tools/check-execstack.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # #//===----------------------------------------------------------------------===// diff --git a/openmp/runtime/tools/check-instruction-set.pl b/openmp/runtime/tools/check-instruction-set.pl index 65c315d59236..6edfb55e99ff 100755 --- a/openmp/runtime/tools/check-instruction-set.pl +++ b/openmp/runtime/tools/check-instruction-set.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # #//===----------------------------------------------------------------------===// diff --git a/openmp/runtime/tools/message-converter.pl b/openmp/runtime/tools/message-converter.pl index b3efb706e59b..22b87c043f78 100755 --- a/openmp/runtime/tools/message-converter.pl +++ b/openmp/runtime/tools/message-converter.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # #//===----------------------------------------------------------------------===// diff --git a/polly/lib/External/isl/doc/mypod2latex b/polly/lib/External/isl/doc/mypod2latex index b11c0593d015..4583bd772d26 100755 --- a/polly/lib/External/isl/doc/mypod2latex +++ b/polly/lib/External/isl/doc/mypod2latex @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use Pod::LaTeX;