Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-37477

decimal_digits_t trips GCC -Wconversion

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      In MDEV-21907, the GCC and clang warning -Wconversion was only enabled for InnoDB and mariadb-backup. If we add #define MYSQL_SERVER to the start of storage/innobase/handler/ha_innodb.cc (to gain access to the internals of THD, for my planned fix of MDEV-37152), then a lot more code will be included the build, and many warnings like the following will be issued:

      10.6 2c30f92dd33c4f0315210db0e4fb9a34c0fb9312

      In file included from /mariadb/10.6/sql/item.h:6603:
      /mariadb/10.6/sql/item_timefunc.h: In constructor ‘Item_func_now::Item_func_now(THD*, uint)’:
      /mariadb/10.6/sql/item_timefunc.h:832:15: error: conversion from ‘uint’ {aka ‘unsigned int’} to ‘decimal_digits_t’ {aka ‘short unsigned int’} may change value [-Werror=conversion]
        832 |   { decimals= dec; }
            |               ^~~
      

      The data type decimal_digits_t had been introduced in MariaDB Server 10.6.1.

      To fix the above example and most other places, we simply need to replace the wider data type alias uint with the narrower decimal_digits_t.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Marko Mäkelä Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.