Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
40421982
Commit
40421982
authored
May 03, 2016
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #312 from dean0x7d/intel-udl-fix
Fix user-defined literal detection for Intel C++ compiler (#311)
parents
b64d13a3
729491ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
4 deletions
+35
-4
fmt/format.h
fmt/format.h
+11
-3
support/cmake/cxx11.cmake
support/cmake/cxx11.cmake
+7
-0
test/CMakeLists.txt
test/CMakeLists.txt
+5
-1
test/compile-test/CMakeLists.txt
test/compile-test/CMakeLists.txt
+12
-0
No files found.
fmt/format.h
View file @
40421982
...
...
@@ -99,7 +99,13 @@ typedef __int64 intmax_t;
# define FMT_GCC_EXTENSION
#endif
#if defined(__clang__) && !defined(__INTEL_COMPILER)
#if defined(__INTEL_COMPILER)
# define FMT_ICC_VERSION __INTEL_COMPILER
#elif defined(__ICL)
# define FMT_ICC_VERSION __ICL
#endif
#if defined(__clang__) && !defined(FMT_ICC_VERSION)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdocumentation"
#endif
...
...
@@ -212,10 +218,12 @@ typedef __int64 intmax_t;
// All compilers which support UDLs also support variadic templates. This
// makes the fmt::literals implementation easier. However, an explicit check
// for variadic templates is added here just in case.
// For Intel's compiler both it and the system gcc/msc must support UDLs.
# define FMT_USE_USER_DEFINED_LITERALS \
FMT_USE_VARIADIC_TEMPLATES && FMT_USE_RVALUE_REFERENCES && \
(FMT_HAS_FEATURE(cxx_user_literals) || \
(FMT_GCC_VERSION >= 407 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1900)
(FMT_GCC_VERSION >= 407 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1900) && \
(!defined(FMT_ICC_VERSION) || FMT_ICC_VERSION >= 1500)
#endif
#ifndef FMT_ASSERT
...
...
@@ -3907,7 +3915,7 @@ operator"" _a(const wchar_t *s, std::size_t) { return {s}; }
# pragma GCC diagnostic pop
#endif
#if defined(__clang__) && !defined(
__INTEL_COMPILER
)
#if defined(__clang__) && !defined(
FMT_ICC_VERSION
)
# pragma clang diagnostic pop
#endif
...
...
support/cmake/cxx11.cmake
View file @
40421982
...
...
@@ -63,4 +63,11 @@ check_cxx_source_compiles("
class C { void operator=(const C&); };
int main() { static_assert(!std::is_copy_assignable<C>::value,
\"\"
); }"
SUPPORTS_TYPE_TRAITS
)
# Check if user-defined literals are available
check_cxx_source_compiles
(
"
void operator
\"\"
_udl(long double);
int main() {}"
SUPPORTS_USER_DEFINED_LITERALS
)
set
(
CMAKE_REQUIRED_FLAGS
)
test/CMakeLists.txt
View file @
40421982
...
...
@@ -123,7 +123,11 @@ if (FMT_PEDANTIC)
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/compile-test"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/compile-test"
--build-generator
${
CMAKE_GENERATOR
}
--build-makeprogram
${
CMAKE_MAKE_PROGRAM
}
)
--build-makeprogram
${
CMAKE_MAKE_PROGRAM
}
--build-options
"-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
"
"-DCPP11_FLAG=
${
CPP11_FLAG
}
"
"-DSUPPORTS_USER_DEFINED_LITERALS=
${
SUPPORTS_USER_DEFINED_LITERALS
}
"
)
# test if the targets are findable from the build directory
add_test
(
find-package-test
${
CMAKE_CTEST_COMMAND
}
...
...
test/compile-test/CMakeLists.txt
View file @
40421982
...
...
@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.8)
include
(
CheckCXXSourceCompiles
)
set
(
CMAKE_REQUIRED_INCLUDES
${
CMAKE_CURRENT_SOURCE_DIR
}
/../..
)
set
(
CMAKE_REQUIRED_FLAGS
${
CPP11_FLAG
}
)
function
(
generate_source result fragment
)
set
(
${
result
}
"
...
...
@@ -57,3 +58,14 @@ expect_compile_error("fmt::MemoryWriter() << fmt::pad(42, 5, L' ');")
expect_compile_error
(
"fmt::format(
\"
{}
\"
, L'a';"
)
expect_compile_error
(
"FMT_STATIC_ASSERT(0 > 1,
\"
oops
\"
);"
)
# Make sure that compiler features detected in the header
# match the features detected in CMake.
if
(
SUPPORTS_USER_DEFINED_LITERALS
)
set
(
supports_udl 1
)
else
()
set
(
supports_udl 0
)
endif
()
expect_compile
(
"#if FMT_USE_USER_DEFINED_LITERALS !=
${
supports_udl
}
# error
#endif"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment