mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-03-12 10:31:00 +01:00
r17472@catbus: nickm | 2008-01-05 22:10:19 -0500
Another test for the increasingly bad check-spaces style checker to check: #else\n#if is almost a sure sign of a failure to use #elif. Fortunately, we only did that 3 times. svn:r13039
This commit is contained in:
parent
864d830598
commit
6d58d80e78
4 changed files with 9 additions and 9 deletions
|
@ -9,6 +9,7 @@ if ($ARGV[0] =~ /^-/) {
|
||||||
for $fn (@ARGV) {
|
for $fn (@ARGV) {
|
||||||
open(F, "$fn");
|
open(F, "$fn");
|
||||||
$lastnil = 0;
|
$lastnil = 0;
|
||||||
|
$lastline = "";
|
||||||
$incomment = 0;
|
$incomment = 0;
|
||||||
while (<F>) {
|
while (<F>) {
|
||||||
## Warn about windows-style newlines.
|
## Warn about windows-style newlines.
|
||||||
|
@ -27,6 +28,11 @@ for $fn (@ARGV) {
|
||||||
if ($C && /\s(?:if|while|for|switch)\(/) {
|
if ($C && /\s(?:if|while|for|switch)\(/) {
|
||||||
print " KW(:$fn:$.\n";
|
print " KW(:$fn:$.\n";
|
||||||
}
|
}
|
||||||
|
## Warn about #else #if instead of #elif.
|
||||||
|
if (($lastline =~ /^\# *else/) and ($_ =~ /^\# *if/)) {
|
||||||
|
print " #else#if:$fn:$.\n";
|
||||||
|
}
|
||||||
|
$lastline = $_;
|
||||||
## Warn about multiple empty lines.
|
## Warn about multiple empty lines.
|
||||||
if ($lastnil && /^$/) {
|
if ($lastnil && /^$/) {
|
||||||
print " DoubleNL:$fn:$.\n";
|
print " DoubleNL:$fn:$.\n";
|
||||||
|
|
|
@ -139,15 +139,13 @@ extern INLINE double U64_TO_DBL(uint64_t x) {
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define STMT_BEGIN (void) ({
|
#define STMT_BEGIN (void) ({
|
||||||
#define STMT_END })
|
#define STMT_END })
|
||||||
#else
|
#elif defined(sun) || defined(__sun__)
|
||||||
#if defined(sun) || defined(__sun__)
|
|
||||||
#define STMT_BEGIN if (1) {
|
#define STMT_BEGIN if (1) {
|
||||||
#define STMT_END } else STMT_NIL
|
#define STMT_END } else STMT_NIL
|
||||||
#else
|
#else
|
||||||
#define STMT_BEGIN do {
|
#define STMT_BEGIN do {
|
||||||
#define STMT_END } while (0)
|
#define STMT_END } while (0)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ===== String compatibility */
|
/* ===== String compatibility */
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
|
|
@ -233,15 +233,13 @@ _tor_malloc_roundup(size_t *sizep DMALLOC_PARAMS)
|
||||||
#ifdef HAVE_MALLOC_GOOD_SIZE
|
#ifdef HAVE_MALLOC_GOOD_SIZE
|
||||||
*sizep = malloc_good_size(*sizep);
|
*sizep = malloc_good_size(*sizep);
|
||||||
return _tor_malloc(*sizep DMALLOC_FN_ARGS);
|
return _tor_malloc(*sizep DMALLOC_FN_ARGS);
|
||||||
#else
|
#elif defined(HAVE_MALLOC_USABLE_SIZE) && !defined(USE_DMALLOC)
|
||||||
#if defined(HAVE_MALLOC_USABLE_SIZE) && !defined(USE_DMALLOC)
|
|
||||||
void *result = _tor_malloc(*sizep DMALLOC_FN_ARGS);
|
void *result = _tor_malloc(*sizep DMALLOC_FN_ARGS);
|
||||||
*sizep = malloc_usable_size(result);
|
*sizep = malloc_usable_size(result);
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
return _tor_malloc(*sizep DMALLOC_FN_ARGS);
|
return _tor_malloc(*sizep DMALLOC_FN_ARGS);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Call the platform malloc info function, and dump the results to the log at
|
/** Call the platform malloc info function, and dump the results to the log at
|
||||||
|
|
|
@ -39,8 +39,7 @@
|
||||||
* security-critical properties.
|
* security-critical properties.
|
||||||
*/
|
*/
|
||||||
#error "Sorry; we don't support building with NDEBUG."
|
#error "Sorry; we don't support building with NDEBUG."
|
||||||
#else
|
#elif defined(__GNUC__)
|
||||||
#ifdef __GNUC__
|
|
||||||
/* Give an int-valued version of !x that won't confuse PREDICT_UNLIKELY. */
|
/* Give an int-valued version of !x that won't confuse PREDICT_UNLIKELY. */
|
||||||
#define IS_FALSE_AS_INT(x) ((x) == ((typeof(x)) 0))
|
#define IS_FALSE_AS_INT(x) ((x) == ((typeof(x)) 0))
|
||||||
#else
|
#else
|
||||||
|
@ -57,7 +56,6 @@
|
||||||
_SHORT_FILE_, __LINE__, __func__, #expr); \
|
_SHORT_FILE_, __LINE__, __func__, #expr); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} STMT_END
|
} STMT_END
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_DMALLOC
|
#ifdef USE_DMALLOC
|
||||||
#define DMALLOC_PARAMS , const char *file, const int line
|
#define DMALLOC_PARAMS , const char *file, const int line
|
||||||
|
|
Loading…
Add table
Reference in a new issue