Skip to content

Conversation

pcolberg
Copy link
Contributor

@pcolberg pcolberg commented Feb 18, 2022

The signedness of char is platform-dependent, e.g., signed on the
platforms supported by the runtime, which causes the following integer
conversion warnings. char is appropriate for a buffer of characters,
whereas unsigned char is appropriate for a buffer of arbitrary bytes.

The signedness change only affects the internal implementation, i.e. the
internal tail buffer and the internal functions using that buffer. The
unit tests provide sufficient coverage to ensure correctness.

[2/14] Building C object lib/acl_hash/CMakeFiles/acl_hash.dir/src/acl_hash.c.o
../lib/acl_hash/src/acl_hash.c: In function ‘l_close’:
../lib/acl_hash/src/acl_hash.c:189:14: warning: conversion to ‘char’ alters ‘int’ constant value [-Wconversion]
   extra[0] = 0x80; // append '1' bit. Assume big endian even within byte.
              ^~~~
../lib/acl_hash/src/acl_hash.c:199:20: warning: conversion to ‘char’ from ‘uint64_t {aka long unsigned int}’ may alter its value [-Wconversion]
     extra[7 - i] = user_bits & 0xff;
                    ^~~~~~~~~

Prerequisite of #85

The signedness of `char` is platform-dependent, e.g., signed on the
platforms supported by the runtime, which causes the following integer
conversion warnings. `char` is appropriate for a buffer of characters,
whereas `unsigned char` is appropriate for a buffer of arbitrary bytes.

The signedness change only affects the internal implementation, i.e. the
internal tail buffer and the internal functions using that buffer. The
unit tests provide sufficient coverage to ensure correctness.

[2/14] Building C object lib/acl_hash/CMakeFiles/acl_hash.dir/src/acl_hash.c.o
../lib/acl_hash/src/acl_hash.c: In function ‘l_close’:
../lib/acl_hash/src/acl_hash.c:189:14: warning: conversion to ‘char’ alters ‘int’ constant value [-Wconversion]
   extra[0] = 0x80; // append '1' bit. Assume big endian even within byte.
              ^~~~
../lib/acl_hash/src/acl_hash.c:199:20: warning: conversion to ‘char’ from ‘uint64_t {aka long unsigned int}’ may alter its value [-Wconversion]
     extra[7 - i] = user_bits & 0xff;
                    ^~~~~~~~~
@pcolberg pcolberg added this to the 2022.3 milestone Feb 18, 2022
@pcolberg pcolberg self-assigned this Feb 18, 2022
@pcolberg pcolberg requested a review from zibaiwan February 18, 2022 23:26
Copy link
Contributor

@zibaiwan zibaiwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Peter for fixing this warning!

@pcolberg pcolberg merged commit 0e228b5 into intel:main Feb 22, 2022
@pcolberg pcolberg deleted the acl-hash-unsigned-char branch February 22, 2022 16:50
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 this pull request may close these issues.

2 participants