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

Add out-of-the-box support for compiling with Intel Compiler v19.0 #1279

Closed
wants to merge 2 commits into from
Closed

Conversation

sharpe5
Copy link

@sharpe5 sharpe5 commented Aug 27, 2019

PR for Issue #1273.

Out of the box, the Intel Compiler v19.0 does not understand the [[deprecated]] attribute and generates a compiler error:

1>.\DemoFmt\github\fmt\include\fmt\core.h(478): error : attribute does not apply to any entity
1>  using wparse_context FMT_DEPRECATED = basic_parse_context<wchar_t>;
1>                       ^

However, it does accept the [[gnu:deprecated]] attribute.

I have updated the following StackOverflow question to document this:
https://stackoverflow.com/questions/295120/c-mark-as-deprecated/57680802#57680802

Tested with the following language levels:

  • C++17 Support (/Qstd=c++17)
  • C++14 Support (/Qstd=c++14)
  • C++11 Support (/Qstd=c++11)
  • C11 Support (/Qstd=c11)
  • C99 Support (/Qstd=c99)

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

@sharpe5
Copy link
Author

sharpe5 commented Aug 27, 2019

To test, install the Intel Compiler v19.0, the use the following in a header-only mode:

#include "pch.h"

#define FMT_HEADER_ONLY 
#include <fmt/core.h> 
#include <fmt/format.h>
#include <iostream>

int main()
{
    std::cout << "Hello World!\n";
    fmt::print("Hello, {}!", "world");
}

@sharpe5
Copy link
Author

sharpe5 commented Aug 27, 2019

To add specific support for Intel Compiler v19.00, this works:

#if (FMT_HAS_CPP_ATTRIBUTE(deprecated)) && __INTEL_COMPILER >= 1900
#    define FMT_DEPRECATED [[gnu::deprecated]]
#endif

I'm not sure how far back [[gnu::deprecated]] is supported by the Intel Compiler.

According to this page, the Intel Compiler does support the [deprecated] attribute, so I think this could almost be considered to be a bug in the Intel Compiler (considering that it is designed to be compatible with MSVC):
https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-std-qstd

@sharpe5
Copy link
Author

sharpe5 commented Aug 27, 2019

Closing this request as further testing shows it is not entirely correct.

The Intel Compiler generally accepts [[deprecated]], but it does not accept [[deprecated]] on certain language elements, such as this:

using wparse_context [[deprecated]] = basic_parse_context<wchar_t>;

The use of [[gnu::deprecated]] appears to be misleading, as it also accepts this:

using wparse_context [[gnu::deprecatedZZZZZ]] = basic_parse_context<wchar_t>;

@sharpe5 sharpe5 closed this Aug 27, 2019
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 this pull request may close these issues.

1 participant