clang-format: restore lost warning on touching formatted file without check
Consistently only assign something to $clang_format if it's a good version, and also consistently return undef if we found no good version. Change-Id: Iadbbb56a5c15dfaeec5c80e3cc8fcc78b787c04b Reviewed-on: https://gerrit.libreoffice.org/46489 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
@@ -133,7 +133,7 @@ sub check_style($)
|
||||
chomp $filename;
|
||||
if ($filename =~ /\.($src)$/ and !exists($blacklist_names->{$filename}))
|
||||
{
|
||||
if (! -x $clang_format)
|
||||
if (!defined($clang_format))
|
||||
{
|
||||
my $version = ClangFormat::get_wanted_version();
|
||||
my $opt_lo = ClangFormat::get_own_directory();
|
||||
|
@@ -65,24 +65,27 @@ sub find()
|
||||
{
|
||||
my $version = get_wanted_version();
|
||||
my $opt_lo = get_own_directory();
|
||||
my $clang_format = $ENV{CLANG_FORMAT};
|
||||
if (!(defined($clang_format) && is_matching_clang_format_version($clang_format, $version)))
|
||||
my $clang_format;
|
||||
if (!(defined($ENV{CLANG_FORMAT}) && is_matching_clang_format_version($ENV{CLANG_FORMAT}, $version)))
|
||||
{
|
||||
$clang_format = "$opt_lo/clang-format";
|
||||
if (!is_matching_clang_format_version($clang_format, $version))
|
||||
my @dirs = split /:/, $ENV{PATH};
|
||||
unshift(@dirs, $opt_lo);
|
||||
|
||||
foreach my $dir (@dirs)
|
||||
{
|
||||
foreach my $dir (split /:/, $ENV{PATH})
|
||||
if (is_matching_clang_format_version("$dir/clang-format", $version))
|
||||
{
|
||||
if (is_matching_clang_format_version("$dir/clang-format", $version))
|
||||
{
|
||||
$clang_format = "$dir/clang-format";
|
||||
last;
|
||||
}
|
||||
$clang_format = "$dir/clang-format";
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$clang_format = $ENV{CLANG_FORMAT};
|
||||
}
|
||||
|
||||
if ($^O eq "cygwin")
|
||||
if ($^O eq "cygwin" && defined($clang_format))
|
||||
{
|
||||
$clang_format = `cygpath -m '$clang_format'`;
|
||||
chomp $clang_format;
|
||||
|
@@ -54,7 +54,6 @@
|
||||
#include <editeng/paravertalignitem.hxx>
|
||||
#include <editeng/blinkitem.hxx>
|
||||
#include <editeng/charhiddenitem.hxx>
|
||||
#include <svx/fmglob.hxx>
|
||||
#include <svx/svdouno.hxx>
|
||||
#include <filter/msfilter/rtfutil.hxx>
|
||||
#include <sfx2/sfxbasemodel.hxx>
|
||||
|
Reference in New Issue
Block a user