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 50482b8c0a #3616
This commit is contained in:
Viktor Szakats 2025-02-26 01:00:43 +01:00
parent 7826927d9b
commit 0f7fef77c5
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201

View File

@ -102,11 +102,6 @@
#include <sys/time.h>
#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)