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

CONC-329: my_bool: change to signed char #49

Closed

Conversation

grooverdan
Copy link
Contributor

Prevents legitimate compile warning on Power and other
architectures that define char to be unsigned (which is allowed by C
standard). In this case the SOCKET_ERROR (-1) is never true.

plugins/pvio/pvio_socket.c:763:42: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always
false [-Wtautological-constant-out-of-range-compare]
if (pvio_socket_blocking(pvio, 1, 0) == SOCKET_ERROR)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
plugins/pvio/pvio_socket.c:875:46: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always
false [-Wtautological-constant-out-of-range-compare]
if (pvio_socket_blocking(pvio, 0, 0) == SOCKET_ERROR)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
plugins/pvio/pvio_socket.c:907:42: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always
false [-Wtautological-constant-out-of-range-compare]
if (pvio_socket_blocking(pvio, 1, 0) == SOCKET_ERROR)

I submit this under the MCA.

@grooverdan grooverdan changed the title my_bool: change to signed char CONC-329: my_bool: change to signed char May 9, 2018
@grooverdan grooverdan changed the base branch from master to 10.2-server May 14, 2018 23:48
@grooverdan
Copy link
Contributor Author

@9EOR9 9EOR9 changed the base branch from 10.2-server to master May 30, 2018 10:41
@9EOR9
Copy link
Collaborator

9EOR9 commented May 30, 2018

Hi,

can you please rebase your commits to a single commit?

POWER and other architectures that define char to be unsigned (which is allowed by C
standard) will not hit conditions in pvio_socket condition and won't be able to process
errors correctly.

plugins/pvio/pvio_socket.c:763:42: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always
      false [-Wtautological-constant-out-of-range-compare]
    if (pvio_socket_blocking(pvio, 1, 0) == SOCKET_ERROR)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
plugins/pvio/pvio_socket.c:875:46: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always
      false [-Wtautological-constant-out-of-range-compare]
        if (pvio_socket_blocking(pvio, 0, 0) == SOCKET_ERROR)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
plugins/pvio/pvio_socket.c:907:42: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always
      false [-Wtautological-constant-out-of-range-compare]
    if (pvio_socket_blocking(pvio, 1, 0) == SOCKET_ERROR)

ma_hext2int: signed char - prevent compiler errors when char is unsigned.

libmariadb/ma_tls.c:169:31: warning: comparison of constant -1 with expression of type 'char' is always false
      [-Wtautological-constant-out-of-range-compare]
    if ((d1 = ma_hex2int(*p)) == - 1 ||
        ~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
libmariadb/ma_tls.c:170:35: warning: comparison of constant -1 with expression of type 'char' is always false
      [-Wtautological-constant-out-of-range-compare]
        (d2 = ma_hex2int(*(p+1))) == -1 ||
        ~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~

mariadb_dyncol_val_str: fix prototype to use char - like implemented function.

unittest: bind.is_null is my_bool - consistency
@grooverdan
Copy link
Contributor Author

grooverdan commented May 31, 2018

done.

I'm still struggling to work out which connector-c branch I should be targeting for various fixes and how these map to server branches.

@9EOR9
Copy link
Collaborator

9EOR9 commented Jul 17, 2018

Hi,

wouldn't it be better to change only the internal blocking function from my_bool to int?

@grooverdan
Copy link
Contributor Author

alternate prepared as #66

here:
my_bool was always implicitly signed char because x86 defaulted to char being signed. This PR makes the existing API the same for other arches. I don't think this changes the API because 0/non-0 where the only real results results.

@grooverdan
Copy link
Contributor Author

Alternate implementation in #66 used instead.

@grooverdan grooverdan closed this Jul 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants