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

Compiler errors with aggressive warnings enabled #140

Closed
jiverson002 opened this issue Mar 28, 2020 · 0 comments
Closed

Compiler errors with aggressive warnings enabled #140

jiverson002 opened this issue Mar 28, 2020 · 0 comments

Comments

@jiverson002
Copy link
Contributor

Compiling with Clang on MacOS and compiler options -Wall -Wextra -pedantic -Werror produces the following error:

.../include/celero/ThreadLocal.h:30:9: error: keyword is hidden by macro
      definition [-Werror,-Wkeyword-macro]
clang++ version: Apple clang version 11.0.3 (clang-1103.0.32.29)

thread_local is a C++11 keyword, so it seems that the check

#ifndef thread_local

will be incorrect whenever thread_local is not defined as a macro.


Compiling with G++ on MacOS and compiler options -Wall -Wextra -pedantic -Werror produces the following error:

.../src/Memory.cpp:66:19: error: 'strlen' was not declared in this scope 
   66 |    const auto i = strlen(line); 
      |

and many more like it.

g++ version: g++-9 (Homebrew GCC 9.3.0) 9.3.0

Looks like Memory.cpp is missing #include <cstring>.

jiverson002 added a commit to jiverson002/Celero that referenced this issue Mar 28, 2020
In file include/celero/ThreadLocal.h:
* `thread_local` is a C++ keyword so using an #ifdef check for its
  existence is not reliable. Instead, check for C++11 support to
  determine if `thread_local` is already defined. See here
  https://stackoverflow.com/questions/5047971/how-do-i-check-for-c11-support.
* Also the check `#if __STDC_VERSION__ >= 201112` is not meaningful,
  since presumably Celero is being compiled with a C++ compiler, so it
  has been removed.

In file src/Memory.cpp:
* Added include for `<cstring>` so that `strlen` and `strncmp` are
  defined for Apple environment.

Fixes DigitalInBlue#140
DigitalInBlue pushed a commit that referenced this issue Mar 28, 2020
In file include/celero/ThreadLocal.h:
* `thread_local` is a C++ keyword so using an #ifdef check for its
  existence is not reliable. Instead, check for C++11 support to
  determine if `thread_local` is already defined. See here
  https://stackoverflow.com/questions/5047971/how-do-i-check-for-c11-support.
* Also the check `#if __STDC_VERSION__ >= 201112` is not meaningful,
  since presumably Celero is being compiled with a C++ compiler, so it
  has been removed.

In file src/Memory.cpp:
* Added include for `<cstring>` so that `strlen` and `strncmp` are
  defined for Apple environment.

Fixes #140
DigitalInBlue added a commit that referenced this issue Feb 24, 2021
* Use _WIN32 instead of WIN32 preprocessor macro (#138)

- _WIN32 is the recommended preprocessor macro
- Substitute occurrences of WIN32 with _WIN32 using:
  git grep -lw -e 'WIN32' -- | xargs sed -i -e 's/\<WIN32\>/_WIN32/g'

* Cleanup some compiler issues on MacOS. (#141)

In file include/celero/ThreadLocal.h:
* `thread_local` is a C++ keyword so using an #ifdef check for its
  existence is not reliable. Instead, check for C++11 support to
  determine if `thread_local` is already defined. See here
  https://stackoverflow.com/questions/5047971/how-do-i-check-for-c11-support.
* Also the check `#if __STDC_VERSION__ >= 201112` is not meaningful,
  since presumably Celero is being compiled with a C++ compiler, so it
  has been removed.

In file src/Memory.cpp:
* Added include for `<cstring>` so that `strlen` and `strncmp` are
  defined for Apple environment.

Fixes #140

* Made it easier to use the Fixed baseline properly with UDMs.

* Improving the "cost of pimpl" experiment.

* #148 Added UDM to the output file

Also remove Google Test submodule.

* Create codeql-analysis.yml (#149)

* Removed requirement for GTest in Travis.ci

* #143 Added clarification to README.md on Doxygen.

* Code Cleanup

* Copyright Update 2021

Co-authored-by: Wolfgang Stöggl <c72578@yahoo.de>
Co-authored-by: jiverson002 <jiverson002@users.noreply.github.com>
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

No branches or pull requests

2 participants