#include "amigaos.h"
#ifdef HAVE_PROTO_BSDSOCKET_H
-# if defined(__amigaos4__)
+# ifdef __amigaos4__
# include <bsdsocket/socketbasetags.h>
# elif !defined(USE_AMISSL)
# include <amitcp/socketbasetags.h>
case CURLOPT_HTTP09_ALLOWED:
s->http09_allowed = enabled;
break;
-#if !defined(CURL_DISABLE_COOKIES)
+#ifndef CURL_DISABLE_COOKIES
case CURLOPT_COOKIESESSION:
/*
* Set this option to TRUE to start a new "cookie session". It will
#else
NULL,
#endif
-#if defined(USE_SSH)
+#ifdef USE_SSH
&Curl_handler_scp,
#else
NULL,
return CURLE_SSH;
}
-#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
static const char *myssh_statename(sshstate state)
{
static const char * const names[] = {
struct ssh_conn *sshc,
sshstate nowstate)
{
-#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
if(sshc->state != nowstate) {
CURL_TRC_SSH(data, "[%s] -> [%s]",
myssh_statename(sshc->state),
Curl_cfree(ptr);
}
-#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
static const char *myssh_statename(sshstate state)
{
static const char * const names[] = {
struct ssh_conn *sshc,
sshstate nowstate)
{
-#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
if(sshc->state != nowstate) {
CURL_TRC_SSH(data, "[%s] -> [%s]",
myssh_statename(sshc->state),
#endif
#ifdef SUPPORTS_SecTrustEvaluateWithError
-#if defined(HAVE_BUILTIN_AVAILABLE)
+#ifdef HAVE_BUILTIN_AVAILABLE
if(__builtin_available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *)) {
#else
if(1) {
'EXCLAMATIONSPACE' => 'Whitespace after exclamation mark in expression',
'FIXME' => 'FIXME or TODO comment',
'FOPENMODE' => 'fopen needs a macro for the mode string',
+ 'IFDEFSINGLE', => 'use ifdef/ifndef for single macro checks',
'INCLUDEDUP', => 'same file is included again',
'INDENTATION' => 'wrong start column for code',
'LONGLINE' => "Line longer than $max_column",
$line, length($1), $file, $l, "\/\/ comment");
}
+ if($l =~ /^\s*#\s*if\s+!?\s*defined\([a-zA-Z0-9_]+\)$/) {
+ checkwarn("IFDEFSINGLE",
+ $line, length($1), $file, $l, "use ifdef/ifndef for single macro checks");
+ }
+
if($l =~ /^(\#\s*include\s+)([\">].*[>}"])/) {
my ($pre, $path) = ($1, $2);
if($includes{$path}) {
(void)purpose;
if(protocol == IPPROTO_TCP)
-#if defined(__linux__)
+#ifdef __linux__
# ifndef IPPROTO_MPTCP
# define IPPROTO_MPTCP 262
# endif
if(sprintf(buffer, "%s", moo)) {}
*buffer_len = (ssize_t)alsobad((char *)buffer, NULL, 16);
+# if defined(SINGLE_MACRO)
+ #if ! defined(__macro_10)
+#elif !defined(TESTMACRO)
+#endif
+#endif
+#endif
+
// CPP comment ?
/* comment does not end
./%LOGDIR/code1185.c:62:25: warning: use of alsobad is banned (BANNEDFUNC)
*buffer_len = (ssize_t)alsobad((char *)buffer, NULL, 16);
^
-./%LOGDIR/code1185.c:64:2: warning: // comment (CPPCOMMENTS)
+./%LOGDIR/code1185.c:64:1: warning: use ifdef/ifndef for single macro checks (IFDEFSINGLE)
+ # if defined(SINGLE_MACRO)
+ ^
+./%LOGDIR/code1185.c:65:1: warning: use ifdef/ifndef for single macro checks (IFDEFSINGLE)
+ #if ! defined(__macro_10)
+ ^
+./%LOGDIR/code1185.c:71:2: warning: // comment (CPPCOMMENTS)
// CPP comment ?
^
./%LOGDIR/code1185.c:1:1: error: Missing copyright statement (COPYRIGHT)
./%LOGDIR/code1185.c:1:1: error: Missing closing comment (OPENCOMMENT)
%SP
^
-checksrc: 0 errors and 42 warnings
+checksrc: 0 errors and 44 warnings
</stdout>
<errorcode>
5