From 0f7fef77c5e4db47d4e5575fb3b6148d959f87b2 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 26 Feb 2025 01:00:43 +0100 Subject: [PATCH] include: stop defining non-curl `__has_declspec_attribute` Public curl headers are best not to define 3rd-party or system macros. Instead check for this macro in the `#if` condition before use. Detected by test1167 after dropping the indentation: ``` test 1167...[Verify curl prefix of public symbols in header files] /usr/bin/perl -I. -I. returned 1, when expecting 0 1167: exit FAILED == Contents of files in the log/10/ dir after test 1167 === Start of file server.cmd Testnum 1167 === End of file server.cmd === Start of file stdout1167 Bad symbols in public header files: __has_declspec_attribute(x) === End of file stdout1167 ``` Ref: https://github.com/curl/curl/actions/runs/13533200900/job/37819784405?pr=16490#step:42:2087 Follow-up to 50482b8c0a2cf5315e66d182998c8fc4901ffb2d #3616 --- include/curl/curl.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/include/curl/curl.h b/include/curl/curl.h index b72d031700..8fed06379c 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -102,11 +102,6 @@ #include #endif -/* Compatibility for non-Clang compilers */ -#ifndef __has_declspec_attribute -# define __has_declspec_attribute(x) 0 -#endif - #ifdef __cplusplus extern "C" { #endif @@ -121,7 +116,8 @@ typedef void CURLSH; #ifdef CURL_STATICLIB # define CURL_EXTERN #elif defined(_WIN32) || \ - (__has_declspec_attribute(dllexport) && \ + (__has_declspec_attribute && \ + __has_declspec_attribute(dllexport) && \ __has_declspec_attribute(dllimport)) # if defined(BUILDING_LIBCURL) # define CURL_EXTERN __declspec(dllexport)