Skip to content

Three unused constants in double-conversion/strod.cpp produce build error with -Wall -Werror -Wunused-const-variable #122

Closed

Description

@Nafanya

This problem was discovered in ICU project that uses double-conversion library, original discussion thread can be found here: unicode-org/icu#956.

The issue is described below:

There are three constants in double-conversion-strod.cpp that are used only if DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS is defined.

I.e. kMaxExactDoubleIntegerDecimalDigits variable (and two others) are only used inside the else part of
#if !defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS). This leads to a compile error when -Wall -Werror enabled:

double-conversion/strtod.cpp:55:18: error: unused variable 'kMaxExactDoubleIntegerDecimalDigits' [-Werror,-Wunused-const-variable]
static const int kMaxExactDoubleIntegerDecimalDigits = 15;

double-conversion/strtod.cpp:72:21: error: variable 'exact_powers_of_ten' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static const double exact_powers_of_ten[] = {

double-conversion/strtod.cpp:98:18: error: unused variable 'kExactPowersOfTenSize' [-Werror,-Wunused-const-variable]
static const int kExactPowersOfTenSize = DOUBLE_CONVERSION_ARRAY_SIZE(exact_powers_of_ten);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions