Skip to content

Fix build error on mingw with clang #4511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pjlib/include/pj/compat/cc_clang.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@

#define PJ_UNREACHED(x)

#define PJ_ALIGN_DATA(declaration, alignment) declaration __attribute__((aligned(alignment)))
/*
* Usage example:
*
* typedef struct PJ_ALIGN_DATA_PREFIX(8) a { int value; } PJ_ALIGN_DATA_SUFFIX(8) a;
* typedef struct PJ_ALIGN_DATA(a{ int value; }, 8) a;
*
* Both options are equivalent, but perhaps the first is a little more readable than the second.
*/
#define PJ_ALIGN_DATA_PREFIX(alignment)
#define PJ_ALIGN_DATA_SUFFIX(alignment) __attribute__((aligned (alignment)))
#define PJ_ALIGN_DATA(declaration, alignment) PJ_ALIGN_DATA_PREFIX(alignment) declaration PJ_ALIGN_DATA_SUFFIX(alignment)

#endif /* __PJ_COMPAT_CC_CLANG_H__ */
15 changes: 7 additions & 8 deletions pjlib/include/pj/compat/cc_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,13 @@
#define PJ_UNREACHED(x)

/*
* Usage example:
*
* typedef struct PJ_ALIGN_DATA_PREFIX(8) a { int value; } PJ_ALIGN_DATA_SUFFIX(8) a;
* typedef struct PJ_ALIGN_DATA(a{ int value; }, 8) a;
*
* Both options are equivalent, but perhaps the first is a little more readable than the second.
*/
//#define PJ_ALIGN_DATA(declaration, alignment) declaration __attribute__((aligned (alignment)))
* Usage example:
*
* typedef struct PJ_ALIGN_DATA_PREFIX(8) a { int value; } PJ_ALIGN_DATA_SUFFIX(8) a;
* typedef struct PJ_ALIGN_DATA(a{ int value; }, 8) a;
*
* Both options are equivalent, but perhaps the first is a little more readable than the second.
*/
#define PJ_ALIGN_DATA_PREFIX(alignment)
#define PJ_ALIGN_DATA_SUFFIX(alignment) __attribute__((aligned (alignment)))
#define PJ_ALIGN_DATA(declaration, alignment) PJ_ALIGN_DATA_PREFIX(alignment) declaration PJ_ALIGN_DATA_SUFFIX(alignment)
Expand Down
17 changes: 7 additions & 10 deletions pjlib/include/pj/compat/cc_msvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,13 @@ typedef unsigned __int64 pj_uint64_t;
#define PJ_UNREACHED(x)

/*
* Usage example:
*
* typedef struct PJ_ALIGN_DATA_PREFIX(8) a { int value; } PJ_ALIGN_DATA_SUFFIX(8) a;
* typedef struct PJ_ALIGN_DATA(a{ int value; }, 8) a;
*
* Both options are equivalent, but perhaps the first is a little more readable than the second.
*/
//#define PJ_ALIGN_DATA(declaration, alignment) __declspec(align(alignment)) declaration
//#pragma warning(disable:4324) // structure padded due to align()
//#define PJ_ALIGN_DATA(declaration, alignment) __pragma(warning(push)) __pragma(warning(disable:4324)) __declspec(align(alignment)) declaration __pragma(warning(pop))
* Usage example:
*
* typedef struct PJ_ALIGN_DATA_PREFIX(8) a { int value; } PJ_ALIGN_DATA_SUFFIX(8) a;
* typedef struct PJ_ALIGN_DATA(a{ int value; }, 8) a;
*
* Both options are equivalent, but perhaps the first is a little more readable than the second.
*/
#define PJ_ALIGN_DATA_PREFIX(alignment) __pragma(warning(push)) __pragma(warning(disable:4324)) __declspec(align(alignment))
#define PJ_ALIGN_DATA_SUFFIX(alignment) __pragma(warning(pop))
#define PJ_ALIGN_DATA(declaration, alignment) PJ_ALIGN_DATA_PREFIX(alignment) declaration PJ_ALIGN_DATA_SUFFIX(alignment)
Expand Down
Loading