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

_RADIAN_BSWAP produces shift count overflow warnings #1

Open
raddari opened this issue Mar 9, 2022 · 0 comments
Open

_RADIAN_BSWAP produces shift count overflow warnings #1

raddari opened this issue Mar 9, 2022 · 0 comments
Assignees
Labels
warning Fix up this warning

Comments

@raddari
Copy link
Owner

raddari commented Mar 9, 2022

Build output from running make:

[ 25%] Building C object _deps/unity-build/CMakeFiles/unity.dir/src/unity.c.o
[ 50%] Linking C static library libunity.a
[ 50%] Built target unity
[ 75%] Building C object test/CMakeFiles/test_read_be.dir/test_read_be.c.o
/home/harvey/code/c/radian/test/test_read_be.c:15:3: warning: shift count >= width of type [-Wshift-count-overflow]
  RADIAN_READ_BE(test_file, de);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/harvey/code/c/radian/include/radian/radian.h:8:41: note: expanded from macro 'RADIAN_READ_BE'
#define RADIAN_READ_BE(file, dest)      _RADIAN_READ_BE(file, dest)
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/harvey/code/c/radian/include/radian/radian-internal.h:58:16: note: expanded from macro '_RADIAN_READ_BE'
        dest = _RADIAN_BSWAP(dest);   \
               ^~~~~~~~~~~~~~~~~~~
/home/harvey/code/c/radian/include/radian/radian-internal.h:21:15: note: expanded from macro '_RADIAN_BSWAP'
    uint64_t: _RADIAN_BSWAP_64(target),           \
              ^~~~~~~~~~~~~~~~~~~~~~~~
/home/harvey/code/c/radian/include/radian/radian-internal.h:34:49: note: expanded from macro '_RADIAN_BSWAP_64'
    ((_RADIAN_BSWAP_32(((target) & 0xFFFFFFFF)) << 32) \
                                                ^  ~~
/home/harvey/code/c/radian/test/test_read_be.c:15:3: warning: shift count >= width of type [-Wshift-count-overflow]
  RADIAN_READ_BE(test_file, de);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/harvey/code/c/radian/include/radian/radian.h:8:41: note: expanded from macro 'RADIAN_READ_BE'
#define RADIAN_READ_BE(file, dest)      _RADIAN_READ_BE(file, dest)
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/harvey/code/c/radian/include/radian/radian-internal.h:58:16: note: expanded from macro '_RADIAN_READ_BE'
        dest = _RADIAN_BSWAP(dest);   \
               ^~~~~~~~~~~~~~~~~~~
/home/harvey/code/c/radian/include/radian/radian-internal.h:21:15: note: expanded from macro '_RADIAN_BSWAP'
    uint64_t: _RADIAN_BSWAP_64(target),           \
              ^~~~~~~~~~~~~~~~~~~~~~~~
/home/harvey/code/c/radian/include/radian/radian-internal.h:35:34: note: expanded from macro '_RADIAN_BSWAP_64'
    | _RADIAN_BSWAP_32(((target) >> 32)))
                                 ^  ~~
/home/harvey/code/c/radian/include/radian/radian-internal.h:30:26: note: expanded from macro '_RADIAN_BSWAP_32'
    ((_RADIAN_BSWAP_16(((target) & 0xFFFF)) << 16)     \
                         ^~~~~~
/home/harvey/code/c/radian/include/radian/radian-internal.h:27:9: note: expanded from macro '_RADIAN_BSWAP_16'
    ((((target) & 0xFF) << 8) | ((target) >> 8))
        ^~~~~~

...
A lot more lines...
...

35 warnings generated.
[100%] Linking C executable test_read_be
[100%] Built target test_read_be
@raddari raddari self-assigned this Mar 9, 2022
@raddari raddari added the warning Fix up this warning label Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
warning Fix up this warning
Projects
None yet
Development

No branches or pull requests

1 participant