Remove trailing whitespace

Additionally, added a GitHub Action to ensure no more trailing
whitespace will creep in again in the future.

I'm excluding Markdown files from this check, since trailing whitespace
is significant there, and also excluding `build-aux/install-sh` because
there is significant trailing whitespace on the line that sets
`defaultIFS`.
This commit is contained in:
Kevin Svetlitski 2023-04-28 12:29:49 -07:00 committed by Qi Wang
parent 05385191d4
commit f2e00d2fd3
12 changed files with 70 additions and 53 deletions

10
.github/workflows/check_formatting.yaml vendored Normal file
View File

@ -0,0 +1,10 @@
name: 'Check Formatting'
on: [pull_request]
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Check for trailing whitespace
run: scripts/check_trailing_whitespace.sh

View File

@ -4504,19 +4504,19 @@ sub FindLibrary {
# For libc libraries, the copy in /usr/lib/debug contains debugging symbols
sub DebuggingLibrary {
my $file = shift;
if ($file !~ m|^/|) {
return undef;
}
# Find debug symbol file if it's named after the library's name.
if (-f "/usr/lib/debug$file") {
if (-f "/usr/lib/debug$file") {
if($main::opt_debug) { print STDERR "found debug info for $file in /usr/lib/debug$file\n"; }
return "/usr/lib/debug$file";
} elsif (-f "/usr/lib/debug$file.debug") {
if($main::opt_debug) { print STDERR "found debug info for $file in /usr/lib/debug$file.debug\n"; }
return "/usr/lib/debug$file.debug";
return "/usr/lib/debug$file.debug";
}
if(!$main::opt_debug_syms_by_id) {
@ -4525,7 +4525,7 @@ sub DebuggingLibrary {
}
# Find debug file if it's named after the library's build ID.
my $readelf = '';
if (!$main::gave_up_on_elfutils) {
$readelf = qx/eu-readelf -n ${file}/;

View File

@ -115,7 +115,7 @@ fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
@ -124,7 +124,7 @@ if [ x"$dir_arg" != x ]; then
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
@ -134,7 +134,7 @@ else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
@ -201,17 +201,17 @@ else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
@ -242,7 +242,7 @@ else
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&

View File

@ -2501,7 +2501,7 @@ AC_SUBST([enable_initial_exec_tls])
if test "x${je_cv_tls_model}" = "xyes" -a \
"x${enable_initial_exec_tls}" = "x1" ; then
AC_DEFINE([JEMALLOC_TLS_MODEL],
[__attribute__((tls_model("initial-exec")))],
[__attribute__((tls_model("initial-exec")))],
[ ])
else
AC_DEFINE([JEMALLOC_TLS_MODEL], [ ], [ ])

View File

@ -446,9 +446,9 @@
/* If defined, use volatile asm during benchmarks. */
#undef JEMALLOC_HAVE_ASM_VOLATILE
/*
* If defined, support the use of rdtscp to get the time stamp counter
* and the processor ID.
/*
* If defined, support the use of rdtscp to get the time stamp counter
* and the processor ID.
*/
#undef JEMALLOC_HAVE_RDTSCP

View File

@ -1,32 +1,32 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2008 Alexander Chemeris
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
if git grep -E '\s+$' -- ':!*.md' ':!build-aux/install-sh'
then
echo 'Error: found trailing whitespace' 1>&2
exit 1
fi

View File

@ -45,7 +45,7 @@
/*-----------------
BASIC DEFINITIONS
-----------------*/
/** Mersenne Exponent. The period of the sequence
/** Mersenne Exponent. The period of the sequence
* is a multiple of 2^MEXP-1.
* #define MEXP 19937 */
/** SFMT generator has an internal state array of 128-bit integers,
@ -63,25 +63,25 @@
following definitions are in paramsXXXX.h file.
----------------------*/
/** the pick up position of the array.
#define POS1 122
#define POS1 122
*/
/** the parameter of shift left as four 32-bit registers.
#define SL1 18
*/
/** the parameter of shift left as one 128-bit register.
* The 128-bit integer is shifted by (SL2 * 8) bits.
#define SL2 1
/** the parameter of shift left as one 128-bit register.
* The 128-bit integer is shifted by (SL2 * 8) bits.
#define SL2 1
*/
/** the parameter of shift right as four 32-bit registers.
#define SR1 11
*/
/** the parameter of shift right as one 128-bit register.
* The 128-bit integer is shifted by (SL2 * 8) bits.
#define SR2 1
/** the parameter of shift right as one 128-bit register.
* The 128-bit integer is shifted by (SL2 * 8) bits.
#define SR2 1
*/
/** A bitmask, used in the recursion. These parameters are introduced
@ -89,7 +89,7 @@
#define MSK1 0xdfffffefU
#define MSK2 0xddfecb7fU
#define MSK3 0xbffaffffU
#define MSK4 0xbffffff6U
#define MSK4 0xbffffff6U
*/
/** These definitions are part of a 128-bit period certification vector.

View File

@ -33,8 +33,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file SFMT.h
/**
* @file SFMT.h
*
* @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom
* number generator
@ -53,7 +53,7 @@
* and you have to define PRIu64 and PRIx64 in this file as follows:
* @verbatim
typedef unsigned int uint32_t
typedef unsigned long long uint64_t
typedef unsigned long long uint64_t
#define PRIu64 "llu"
#define PRIx64 "llx"
@endverbatim
@ -84,8 +84,8 @@ int get_min_array_size64(void);
/* These real versions are due to Isaku Wada */
/** generates a random number on [0,1]-real-interval */
static inline double to_real1(uint32_t v) {
return v * (1.0/4294967295.0);
/* divided by 2^32-1 */
return v * (1.0/4294967295.0);
/* divided by 2^32-1 */
}
/** generates a random number on [0,1]-real-interval */
@ -95,7 +95,7 @@ static inline double genrand_real1(sfmt_t *ctx) {
/** generates a random number on [0,1)-real-interval */
static inline double to_real2(uint32_t v) {
return v * (1.0/4294967296.0);
return v * (1.0/4294967296.0);
/* divided by 2^32 */
}
@ -106,7 +106,7 @@ static inline double genrand_real2(sfmt_t *ctx) {
/** generates a random number on (0,1)-real-interval */
static inline double to_real3(uint32_t v) {
return (((double)v) + 0.5)*(1.0/4294967296.0);
return (((double)v) + 0.5)*(1.0/4294967296.0);
/* divided by 2^32 */
}

View File

@ -26,7 +26,7 @@ do_arena_create(ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
static inline void
do_arena_destroy(unsigned arena_ind) {
/*
/*
* For convenience, flush tcache in case there are cached items.
* However not assert success since the tcache may be disabled.
*/

View File

@ -28,12 +28,12 @@ timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen) {
size_t i = 0;
size_t j, n;
/*
* The time difference could be 0 if the two clock readings are
/*
* The time difference could be 0 if the two clock readings are
* identical, either due to the operations being measured in the middle
* took very little time (or even got optimized away), or the clock
* took very little time (or even got optimized away), or the clock
* readings are bad / very coarse grained clock.
* Thus, bump t1 if it is 0 to avoid dividing 0.
* Thus, bump t1 if it is 0 to avoid dividing 0.
*/
if (t1 == 0) {
t1 = 1;

View File

@ -52,15 +52,15 @@ malloc_sdallocx(void) {
#endif
TEST_BEGIN(test_free_vs_delete) {
compare_funcs(10*1000*1000, 100*1000*1000,
"malloc_free", (void *)malloc_free,
compare_funcs(10*1000*1000, 100*1000*1000,
"malloc_free", (void *)malloc_free,
"new_delete", (void *)new_delete);
}
TEST_END
TEST_BEGIN(test_free_array_vs_delete_array) {
compare_funcs(10*1000*1000, 100*1000*1000,
"malloc_free_array", (void *)malloc_free_array,
compare_funcs(10*1000*1000, 100*1000*1000,
"malloc_free_array", (void *)malloc_free_array,
"delete_array", (void *)new_delete_array);
}
TEST_END
@ -68,8 +68,8 @@ TEST_END
TEST_BEGIN(test_sized_delete_vs_sdallocx) {
#if __cpp_sized_deallocation >= 201309
compare_funcs(10*1000*1000, 100*1000*1000,
"new_size_delete", (void *)new_sized_delete,
compare_funcs(10*1000*1000, 100*1000*1000,
"new_size_delete", (void *)new_sized_delete,
"malloc_sdallocx", (void *)malloc_sdallocx);
#else
malloc_printf("Skipping test_sized_delete_vs_sdallocx since \