Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
e6107a78
Commit
e6107a78
authored
Oct 11, 2014
by
Dominic Hamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #50 by using nullptr and adding stricter warning.
parent
cfb34b59
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
6 deletions
+14
-6
CMakeLists.txt
CMakeLists.txt
+1
-0
CXXFeatureCheck.cmake
cmake/CXXFeatureCheck.cmake
+8
-3
gnu_posix_regex.cpp
cmake/gnu_posix_regex.cpp
+1
-1
posix_regex.cpp
cmake/posix_regex.cpp
+1
-1
std_regex.cpp
cmake/std_regex.cpp
+3
-1
No files found.
CMakeLists.txt
View file @
e6107a78
...
@@ -40,6 +40,7 @@ add_cxx_compiler_flag(-Wall)
...
@@ -40,6 +40,7 @@ add_cxx_compiler_flag(-Wall)
add_cxx_compiler_flag
(
-Wshadow
)
add_cxx_compiler_flag
(
-Wshadow
)
add_cxx_compiler_flag
(
-Werror
)
add_cxx_compiler_flag
(
-Werror
)
add_cxx_compiler_flag
(
-pedantic-errors
)
add_cxx_compiler_flag
(
-pedantic-errors
)
add_cxx_compiler_flag
(
-Wzero-as-null-pointer-constant
)
# Release flags
# Release flags
add_cxx_compiler_flag
(
-fno-strict-aliasing RELEASE
)
add_cxx_compiler_flag
(
-fno-strict-aliasing RELEASE
)
...
...
cmake/CXXFeatureCheck.cmake
View file @
e6107a78
...
@@ -22,13 +22,18 @@ function(cxx_feature_check FILE)
...
@@ -22,13 +22,18 @@ function(cxx_feature_check FILE)
string
(
TOUPPER
${
FILE
}
VAR
)
string
(
TOUPPER
${
FILE
}
VAR
)
string
(
TOUPPER
"HAVE_
${
VAR
}
"
FEATURE
)
string
(
TOUPPER
"HAVE_
${
VAR
}
"
FEATURE
)
message
(
"-- Performing Test
${
FEATURE
}
"
)
message
(
"-- Performing Test
${
FEATURE
}
"
)
try_run
(
RUN_
${
FEATURE
}
COMPILE_
${
FEATURE
}
${
CMAKE_BINARY_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/
${
FILE
}
.cpp
)
try_run
(
RUN_
${
FEATURE
}
COMPILE_
${
FEATURE
}
${
CMAKE_BINARY_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/
${
FILE
}
.cpp
)
if
(
RUN_
${
FEATURE
}
EQUAL 0
)
if
(
RUN_
${
FEATURE
}
EQUAL 0
)
message
(
"-- Performing Test
${
FEATURE
}
--
S
uccess"
)
message
(
"-- Performing Test
${
FEATURE
}
--
s
uccess"
)
set
(
HAVE_
${
VAR
}
1 PARENT_SCOPE
)
set
(
HAVE_
${
VAR
}
1 PARENT_SCOPE
)
add_definitions
(
-DHAVE_
${
VAR
}
)
add_definitions
(
-DHAVE_
${
VAR
}
)
else
()
else
()
message
(
"-- Performing Test
${
FEATURE
}
-- Failed"
)
if
(
NOT COMPILE_
${
FEATURE
}
)
message
(
"-- Performing Test
${
FEATURE
}
-- failed to compile"
)
else
()
message
(
"-- Performing Test
${
FEATURE
}
-- compiled but failed to run"
)
endif
()
endif
()
endif
()
endfunction
()
endfunction
()
cmake/gnu_posix_regex.cpp
View file @
e6107a78
...
@@ -7,6 +7,6 @@ int main() {
...
@@ -7,6 +7,6 @@ int main() {
if
(
ec
!=
0
)
{
if
(
ec
!=
0
)
{
return
ec
;
return
ec
;
}
}
return
regexec
(
&
re
,
str
.
c_str
(),
0
,
NULL
,
0
)
?
-
1
:
0
;
return
regexec
(
&
re
,
str
.
c_str
(),
0
,
nullptr
,
0
)
?
-
1
:
0
;
}
}
cmake/posix_regex.cpp
View file @
e6107a78
...
@@ -7,6 +7,6 @@ int main() {
...
@@ -7,6 +7,6 @@ int main() {
if
(
ec
!=
0
)
{
if
(
ec
!=
0
)
{
return
ec
;
return
ec
;
}
}
return
regexec
(
&
re
,
str
.
c_str
(),
0
,
NULL
,
0
)
?
-
1
:
0
;
return
regexec
(
&
re
,
str
.
c_str
(),
0
,
nullptr
,
0
)
?
-
1
:
0
;
}
}
cmake/std_regex.cpp
View file @
e6107a78
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
#include <string>
#include <string>
int
main
()
{
int
main
()
{
const
std
::
string
str
=
"test0159"
;
const
std
::
string
str
=
"test0159"
;
const
std
::
regex
re
(
"^[a-z]+[0-9]+$"
,
std
::
regex_constants
::
extended
|
std
::
regex_constants
::
nosubs
);
const
std
::
regex
re
(
"^[a-z]+[0-9]+$"
,
std
::
regex_constants
::
extended
|
std
::
regex_constants
::
nosubs
);
return
std
::
regex_search
(
str
,
re
)
?
0
:
-
1
;
return
std
::
regex_search
(
str
,
re
)
?
0
:
-
1
;
}
}
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