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

Clang warnings #256

Closed
marxin opened this issue Aug 15, 2023 · 2 comments · Fixed by #257
Closed

Clang warnings #256

marxin opened this issue Aug 15, 2023 · 2 comments · Fixed by #257

Comments

@marxin
Copy link

marxin commented Aug 15, 2023

I've noticed the following Clang warnings:

/home/conan/w/prod-v1/BuildSingleReference/.conan/data/libe57format/3.0.2/_/_/build/502976e801cbdd00546a7463b5dcc4fd2fba2330/src/src/SourceDestBufferImpl.cpp:495:39: error: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
   if ( doubleRawValue < INT64_MIN || INT64_MAX < doubleRawValue )
                                      ^~~~~~~~~ ~
/usr/include/stdint.h:163:22: note: expanded from macro 'INT64_MAX'
# define INT64_MAX              (__INT64_C(9223372036854775807))
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdint.h:145:24: note: expanded from macro '__INT64_C'
#  define __INT64_C(c)  c ## L
                        ^~~~~~
<scratch space>:47:1: note: expanded from here
9223372036854775807L
^~~~~~~~~~~~~~~~~~~~
/home/conan/w/prod-v1/BuildSingleReference/.conan/data/libe57format/3.0.2/_/_/build/502976e801cbdd00546a7463b5dcc4fd2fba2330/src/src/SourceDestBufferImpl.cpp:206:38: error: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Werror,-Wimplicit-const-int-float-conversion]
         if ( inValue < INT32_MIN || INT32_MAX < inValue )
                                     ^~~~~~~~~ ~
/usr/include/stdint.h:162:22: note: expanded from macro 'INT32_MAX'
# define INT32_MAX              (2147483647)
                                 ^~~~~~~~~~
/home/conan/w/prod-v1/BuildSingleReference/.conan/data/libe57format/3.0.2/_/_/build/502976e801cbdd00546a7463b5dcc4fd2fba2330/src/src/SourceDestBufferImpl.cpp:944:4: note: in instantiation of function template specialization 'e57::SourceDestBufferImpl::_setNextReal<float>' requested here
   _setNextReal( value );
   ^
/home/conan/w/prod-v1/BuildSingleReference/.conan/data/libe57format/3.0.2/_/_/build/502976e801cbdd00546a7463b5dcc4fd2fba2330/src/src/SourceDestBufferImpl.cpp:218:39: error: implicit conversion from 'unsigned int' to 'float' changes value from 4294967295 to 4294967296 [-Werror,-Wimplicit-const-int-float-conversion]
         if ( inValue < UINT32_MIN || UINT32_MAX < inValue )
                                      ^~~~~~~~~~ ~
/usr/include/stdint.h:168:23: note: expanded from macro 'UINT32_MAX'
# define UINT32_MAX             (4294967295U)
                                 ^~~~~~~~~~~
/home/conan/w/prod-v1/BuildSingleReference/.conan/data/libe57format/3.0.2/_/_/build/502976e801cbdd00546a7463b5dcc4fd2fba2330/src/src/SourceDestBufferImpl.cpp:230:38: error: implicit conversion from 'long' to 'float' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
         if ( inValue < INT64_MIN || INT64_MAX < inValue )
                                     ^~~~~~~~~ ~
/usr/include/stdint.h:163:22: note: expanded from macro 'INT64_MAX'
# define INT64_MAX              (__INT64_C(9223372036854775807))
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdint.h:145:24: note: expanded from macro '__INT64_C'
#  define __INT64_C(c)  c ## L
                        ^~~~~~
<scratch space>:5:1: note: expanded from here
9223372036854775807L
^~~~~~~~~~~~~~~~~~~~
/home/conan/w/prod-v1/BuildSingleReference/.conan/data/libe57format/3.0.2/_/_/build/502976e801cbdd00546a7463b5dcc4fd2fba2330/src/src/SourceDestBufferImpl.cpp:230:38: error: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
         if ( inValue < INT64_MIN || INT64_MAX < inValue )
                                     ^~~~~~~~~ ~
/usr/include/stdint.h:163:22: note: expanded from macro 'INT64_MAX'
# define INT64_MAX              (__INT64_C(9223372036854775807))
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdint.h:145:24: note: expanded from macro '__INT64_C'
#  define __INT64_C(c)  c ## L
                        ^~~~~~
<scratch space>:5:1: note: expanded from here
9223372036854775807L
^~~~~~~~~~~~~~~~~~~~
/home/conan/w/prod-v1/BuildSingleReference/.conan/data/libe57format/3.0.2/_/_/build/502976e801cbdd00546a7463b5dcc4fd2fba2330/src/src/SourceDestBufferImpl.cpp:949:4: note: in instantiation of function template specialization 'e57::SourceDestBufferImpl::_setNextReal<double>' requested here
   _setNextReal( value );
   
@asmaloney
Copy link
Owner

What version? What OS?

@marxin
Copy link
Author

marxin commented Aug 15, 2023

It's Clang 13 on MacOS:
warning.txt

asmaloney added a commit that referenced this issue Aug 15, 2023
These should be safe because we aren't checking equality.

Note that Apple's clang doesn't warn about these, but it looks like the official clang releases do.

Fixes #256
asmaloney added a commit that referenced this issue Aug 15, 2023
These should be safe because we aren't checking equality.

Note that Apple's clang doesn't warn about these, but it looks like the official clang releases do.

Fixes #256
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 a pull request may close this issue.

2 participants