Skip to content

Commit

Permalink
Use __attribute__ when building with clang on windows
Browse files Browse the repository at this point in the history
Since clang supports __attribute__ we can avoid disabling
it and use packed sdshdr structs. This also make sure we dont
affect subsequent header files that require __attribute__.

Note:
Clang attempts to be compatible with MSVC and defines _MSC_VER
  • Loading branch information
bjosv authored and michael-grunder committed Sep 14, 2022
1 parent 5392adc commit bd9ccb8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sds.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@

#define SDS_MAX_PREALLOC (1024*1024)
#ifdef _MSC_VER
#define __attribute__(x)
typedef long long ssize_t;
#define SSIZE_MAX (LLONG_MAX >> 1)
#ifndef __clang__
#define __attribute__(x)
#endif
#endif

#include <sys/types.h>
Expand Down

0 comments on commit bd9ccb8

Please sign in to comment.