[gnutls-devel] GnuTLS | Empty _CONSTRUCTOR/_DESTRUCTOR for clang-cl (#1454)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Thu Feb 16 13:49:27 CET 2023



Gisle Vanem created an issue: https://gitlab.com/gnutls/gnutls/-/issues/1454



Building with MSVC seems impossible, but using `clang-cl` should IMHO be possible (due to resemblance to gcc).<br>
But I discovered the constructor / destructor in `global.c` did absolutely nothing due to these lines in `str.h`:
```c
# ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later.  */
#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
#   define __attribute__(Spec) /* empty */
```

It seems `clang-cl` processor does not recognizes `__ attribute__` as a built-in.<br>
Hence with this patch:
```diff
--- a/lib/str.h 2023-02-11 21:35:44
+++ b/lib/str.h 2023-02-16 13:22:06
@@ -168,7 +168,7 @@
                             size_t data_size, const char *invalid_chars);
 int _gnutls_buffer_unescape(gnutls_buffer_st * dest);

-# ifndef __attribute__
+# if !defined(__attribute__) && !defined(__clang__)
 /* This feature is available in gcc versions 2.5 and later.  */
 #  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
 #   define __attribute__(Spec) /* empty */
```

I'm able to successfully run (so far) 15 programs under `./test`.

There are other issues, but I hope Windows could be supported better.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1454
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20230216/1ca01bd9/attachment.html>


More information about the Gnutls-devel mailing list