Skip to content
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

Building with c++14/17 fails on clang #3250

Closed
danlark1 opened this issue Aug 25, 2022 · 0 comments · Fixed by #3273
Closed

Building with c++14/17 fails on clang #3250

danlark1 opened this issue Aug 25, 2022 · 0 comments · Fixed by #3273

Comments

@danlark1
Copy link
Contributor

danlark1 commented Aug 25, 2022

Describe the bug

When building with C++17, zstd fails

[./third_party/zstdlib/zstd.h:191]:1: error: an attribute list cannot appear here
ZSTD_DEPRECATED("Replaced by ZSTD_getFrameContentSize")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[./third_party/zstdlib/zstd.h:49]:38: note: expanded from macro 'ZSTD_DEPRECATED'
#    define ZSTD_DEPRECATED(message) [[deprecated(message)]]
                                     ^~~~~~~~~~~~~~~~~~~~~~~

I believe it came from

https://github.com/facebook/zstd/pull/3225/files

where before it was

if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
#    define ZSTD_DEPRECATED(message) [[deprecated(message)]] ZSTDLIB_STATIC_API

And after it became in reverse order

ZSTDLIB_API
ZSTD_DEPRECATED("Replaced by ZSTD_getFrameContentSize")
unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);

I see that the order is slightly inconsistent throughout the file, for example in c450f9f the order of ZSTD_DEPRECATED/ZSTDLIB_API in reversed

To Reproduce

  1. Include ZSTD in a C++ source file and build with C++14/17

Expected behavior
Builds

Screenshots and charts
If applicable, add screenshots and charts to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux
  • Version 1.5.3
  • Compiler clang
  • Flags -std=c++17
  • Other relevant hardware specs [e.g. Dual-core]
  • Build system CMake, Makefile
MaskRay added a commit to MaskRay/zstd that referenced this issue Sep 22, 2022
Clang doesn't allow [[deprecated(...)]] attribute after __attribute__.
Move [[deprecated(...)]] before __attribute__ to fix C++14/C++17 uses
with Clang.

Fix facebook#3250
MaskRay added a commit to MaskRay/zstd that referenced this issue Sep 22, 2022
Clang doesn't allow [[deprecated(...)]] attribute after __attribute__.
Move [[deprecated(...)]] before __attribute__ to fix C++14/C++17 uses
with Clang.

Fix facebook#3250
MaskRay added a commit to MaskRay/zstd that referenced this issue Sep 22, 2022
Clang doesn't allow [[deprecated(...)]] attribute after __attribute__.
Move [[deprecated(...)]] before __attribute__ to fix C++14/C++17 uses
with Clang.

Fix facebook#3250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant