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
3a04ebf1
Commit
3a04ebf1
authored
May 02, 2016
by
Dean Moldovan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix user-defined literal detection for Intel C++ compiler
parent
b64d13a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
fmt/format.h
fmt/format.h
+9
-1
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 @
3a04ebf1
...
@@ -99,6 +99,12 @@ typedef __int64 intmax_t;
...
@@ -99,6 +99,12 @@ typedef __int64 intmax_t;
# define FMT_GCC_EXTENSION
# define FMT_GCC_EXTENSION
#endif
#endif
#if defined(__INTEL_COMPILER)
# define FMT_ICC_VERSION __INTEL_COMPILER
#elif defined(__ICL)
# define FMT_ICC_VERSION __ICL
#endif
#if defined(__clang__) && !defined(__INTEL_COMPILER)
#if defined(__clang__) && !defined(__INTEL_COMPILER)
# pragma clang diagnostic push
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdocumentation"
# pragma clang diagnostic ignored "-Wdocumentation"
...
@@ -212,10 +218,12 @@ typedef __int64 intmax_t;
...
@@ -212,10 +218,12 @@ typedef __int64 intmax_t;
// All compilers which support UDLs also support variadic templates. This
// All compilers which support UDLs also support variadic templates. This
// makes the fmt::literals implementation easier. However, an explicit check
// makes the fmt::literals implementation easier. However, an explicit check
// for variadic templates is added here just in case.
// 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 \
# define FMT_USE_USER_DEFINED_LITERALS \
FMT_USE_VARIADIC_TEMPLATES && FMT_USE_RVALUE_REFERENCES && \
FMT_USE_VARIADIC_TEMPLATES && FMT_USE_RVALUE_REFERENCES && \
(FMT_HAS_FEATURE(cxx_user_literals) || \
(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
#endif
#ifndef FMT_ASSERT
#ifndef FMT_ASSERT
...
...
support/cmake/cxx11.cmake
View file @
3a04ebf1
...
@@ -63,4 +63,11 @@ check_cxx_source_compiles("
...
@@ -63,4 +63,11 @@ check_cxx_source_compiles("
class C { void operator=(const C&); };
class C { void operator=(const C&); };
int main() { static_assert(!std::is_copy_assignable<C>::value,
\"\"
); }"
int main() { static_assert(!std::is_copy_assignable<C>::value,
\"\"
); }"
SUPPORTS_TYPE_TRAITS
)
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
)
set
(
CMAKE_REQUIRED_FLAGS
)
test/CMakeLists.txt
View file @
3a04ebf1
...
@@ -123,7 +123,11 @@ if (FMT_PEDANTIC)
...
@@ -123,7 +123,11 @@ if (FMT_PEDANTIC)
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/compile-test"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/compile-test"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/compile-test"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/compile-test"
--build-generator
${
CMAKE_GENERATOR
}
--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
# test if the targets are findable from the build directory
add_test
(
find-package-test
${
CMAKE_CTEST_COMMAND
}
add_test
(
find-package-test
${
CMAKE_CTEST_COMMAND
}
...
...
test/compile-test/CMakeLists.txt
View file @
3a04ebf1
...
@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.8)
...
@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.8)
include
(
CheckCXXSourceCompiles
)
include
(
CheckCXXSourceCompiles
)
set
(
CMAKE_REQUIRED_INCLUDES
${
CMAKE_CURRENT_SOURCE_DIR
}
/../..
)
set
(
CMAKE_REQUIRED_INCLUDES
${
CMAKE_CURRENT_SOURCE_DIR
}
/../..
)
set
(
CMAKE_REQUIRED_FLAGS
${
CPP11_FLAG
}
)
function
(
generate_source result fragment
)
function
(
generate_source result fragment
)
set
(
${
result
}
"
set
(
${
result
}
"
...
@@ -57,3 +58,14 @@ expect_compile_error("fmt::MemoryWriter() << fmt::pad(42, 5, L' ');")
...
@@ -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::format(
\"
{}
\"
, L'a';"
)
expect_compile_error
(
"FMT_STATIC_ASSERT(0 > 1,
\"
oops
\"
);"
)
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