Project

General

Profile

Actions

Bug #49167

open

s3select compilation warnings

Added by Casey Bodley about 3 years ago. Updated about 3 years ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
-
% Done:

0%

Source:
Tags:
s3select
Backport:
pacific
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

from gcc:

In file included from src/s3select/include/s3select.h:10,
                 from src/rgw/rgw_rest_s3.cc:21:
src/s3select/include/s3select_oper.h: In member function 'virtual s3selectEngine::value& s3selectEngine::logical_operand::eval_internal()':
src/s3select/include/s3select_oper.h:594:21: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
     this->__val.num = (int64_t)b;
     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
src/s3select/include/s3select_oper.h:1459:10: note: 'res' was declared here
     bool res;
          ^~~

from clang:

In file included from src/rgw/rgw_rest_s3.cc:21:
In file included from src/s3select/include/s3select.h:11:
src/s3select/include/s3select_functions.h:541:37: warning: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036
854775808 [-Wimplicit-const-int-float-conversion]
      if ((errno == ERANGE && (d == LONG_MAX || d == LONG_MIN)) || (errno != 0 && d == 0)) {
                                 ~~ ^~~~~~~~
/usr/lib64/clang/11.0.0/include/limits.h:47:19: note: expanded from macro 'LONG_MAX'
#define LONG_MAX  __LONG_MAX__
                  ^~~~~~~~~~~~
<built-in>:94:22: note: expanded from here
#define __LONG_MAX__ 9223372036854775807L
                     ^~~~~~~~~~~~~~~~~~~~
1 warning generated.

In file included from ../src/rgw/rgw_rest_s3.cc:21:
In file included from ../src/s3select/include/s3select.h:9:
../src/s3select/include/s3select_oper.h:183:57: warning: unused variable 'iter' [-Wunused-variable]
    std::vector<std::pair<std::string, int >>::iterator iter;
                                                        ^

Actions #1

Updated by Gal Salomon about 3 years ago

the unused flag is already in make-file. (currently no warning for that)
we about to install git-action with clang-tidy, this should resolve these kind of issues.

Actions #2

Updated by Casey Bodley about 3 years ago

In file included from src/rgw/rgw_rest_s3.cc:21:
In file included from src/s3select/include/s3select.h:11:
src/s3select/include/s3select_functions.h:541:37: warning: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036
854775808 [-Wimplicit-const-int-float-conversion]
      if ((errno == ERANGE && (d == LONG_MAX || d == LONG_MIN)) || (errno != 0 && d == 0)) {
                                 ~~ ^~~~~~~~

this one points at incorrect use of strtod(). according to https://en.cppreference.com/w/c/string/byte/strtof:

Return value
Floating-point value corresponding to the contents of str on success. If the converted value falls out of range of corresponding return type, range error occurs and HUGE_VAL, HUGE_VALF or HUGE_VALL is returned. If no conversion can be performed, ​0​ is returned.

LONG_MIN/MAX are only returned by strtol()

Actions #3

Updated by Gal Salomon about 3 years ago

the LONG_MIN/MAX issue is fixed on 2e8eb705eaa5b1ec6a6d28b17701abcd60fb0523 (Feb 22)

Actions #4

Updated by Gal Salomon about 3 years ago

as for
/src/s3select/include/s3select_oper.h:1459:10: note: 'res' was declared here /

not getting that warnings, but will change 'res' scope

as for /../src/s3select/include/s3select_oper.h:183:57: warning: unused variable 'iter' [-Wunused-variable] /
cam not locate that

Actions

Also available in: Atom PDF