[MDEV-8080] gcc-5 compile warnings -Wparentheses - mixing logical and bitwise operators Created: 2015-04-29  Updated: 2023-01-22  Resolved: 2023-01-22

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.0.17
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Daniel Black Assignee: Sergei Golubchik
Resolution: Cannot Reproduce Votes: 0
Labels: None
Environment:

gcc-5 / ubuntu-12.04



 Description   

https://travis-ci.org/openquery/mariadb-server/jobs/60545852

looks like ! (logic negate) should be ~ (bitwise negate) to work with &.

/home/travis/build/openquery/mariadb-server/sql/sql_select.cc: In function ‘double table_multi_eq_cond_selectivity(JOIN*, uint, JOIN_TAB*, table_map, uint, uint16*)’:
/home/travis/build/openquery/mariadb-server/sql/sql_select.cc:7304:26: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
         if (!fld->table->map & ~(table_bit | rem_tables))
                          ^
/home/travis/build/openquery/mariadb-server/sql/sql_select.cc: In function ‘int test_if_order_by_key(ORDER*, TABLE*, uint, uint*)’:
/home/travis/build/openquery/mariadb-server/sql/sql_select.cc:20052:50: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
     if (!table->file->index_flags(pk, pk_parts, 1) & HA_READ_PREV)

In file included from /home/travis/build/openquery/mariadb-server/storage/xtradb/include/log0recv.h:29:0,
                 from /home/travis/build/openquery/mariadb-server/storage/xtradb/log/log0recv.cc:33:
/home/travis/build/openquery/mariadb-server/storage/xtradb/log/log0recv.cc: In function ‘void recv_apply_hashed_log_recs(ulint)’:
/home/travis/build/openquery/mariadb-server/storage/xtradb/log/log0recv.cc:1944:20: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
  ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
                    ^
/home/travis/build/openquery/mariadb-server/storage/xtradb/include/univ.i:631:35: note: in definition of macro ‘UNIV_EXPECT’
 # define UNIV_EXPECT(expr,value) (expr)
                                   ^
/home/travis/build/openquery/mariadb-server/storage/xtradb/include/ut0dbg.h:43:28: note: in expansion of macro ‘UNIV_UNLIKELY’
 # define UT_DBG_FAIL(EXPR) UNIV_UNLIKELY(!((ulint)(EXPR)))
                            ^
/home/travis/build/openquery/mariadb-server/storage/xtradb/include/ut0dbg.h:70:6: note: in expansion of macro ‘UT_DBG_FAIL’
  if (UT_DBG_FAIL(EXPR)) {    \
      ^
/home/travis/build/openquery/mariadb-server/storage/xtradb/include/ut0dbg.h:85:21: note: in expansion of macro ‘ut_a’
 #define ut_ad(EXPR) ut_a(EXPR)
                     ^
/home/travis/build/openquery/mariadb-server/storage/xtradb/log/log0recv.cc:1944:2: note: in expansion of macro ‘ut_ad’
  ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));

/home/travis/build/openquery/mariadb-server/storage/xtradb/btr/btr0cur.cc: In function ‘dberr_t btr_cur_pessimistic_insert(ulint, btr_cur_t*, ulint**, mem_heap_t**, dtuple_t*, rec_t**, big_rec_t**, ulint, que_thr_t*, mtr_t*)’:
/home/travis/build/openquery/mariadb-server/storage/xtradb/btr/btr0cur.cc:1749:36: warning: null argument where non-null required (argument 1) [-Wnonnull]
     btr_cur_get_block(cursor)), mtr)
                                    ^

[ 24%] /home/travis/build/openquery/mariadb-server/storage/xtradb/btr/btr0scrub.cc: In function ‘int btr_scrub_page(btr_scrub_t*, buf_block_t*, btr_scrub_page_allocation_status_t, mtr_t*)’:
/home/travis/build/openquery/mariadb-server/storage/xtradb/btr/btr0scrub.cc:787:54: warning: null argument where non-null required (argument 1) [-Wnonnull]
  if (btr_page_get_index_id(buf_block_get_frame(block)) !=
                                     



 Comments   
Comment by Elena Stepanova [ 2023-01-22 ]

I don't think we use gcc 5/6 anywhere anymore. We still have 4.8 and 7.5, I don't see the first warnings there (and the second block about XtraDB is no longer applicable).

Generated at Thu Feb 08 07:24:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.