Skip to content

locale.c: New build-time warnings when built with clang14 #21288

Closed
@jkeenan

Description

@jkeenan

Tonight for the first time in several months I configured and built a perl on FreeBSD-12 for the purpose of detecting build-time warnings. I build with a commit from recent days (post-5.37.1) and compiled with clang14.

$ clang14 --version
clang version 14.0.6
Target: x86_64-portbld-freebsd12.3
Thread model: posix
InstalledDir: /usr/local/llvm14/bin

$ sh ./Configure -des -Dusedevel -Duseithreads -Dcc=clang14 && \
make test_prep

$ parse-build-warnings d9203338cf.freebsd.threaded.clang14.maketp.output.txt.gz
File:  d9203338cf.freebsd.threaded.clang14.maketp.output.txt.gz

[
  {
    char   => 48,
    group  => "Wunused-parameter",
    line   => 408,
    source => "locale.c",
    text   => "unused parameter 'caller_line'",
  },
  {
    char   => 21,
    group  => "Wunused-const-variable",
    line   => 313,
    source => "locale.c",
    text   => "unused variable 'category_name_lengths'",
  },
  ...
]

(There were also 4 previously observed build-time warnings from cpan/*Compress* modules.)

In the output of make test_prep I saw:

clang14 -c -DPERL_CORE -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -std=c99 -O2 -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings locale.c
locale.c:408:48: warning: unused parameter 'caller_line' [-Wunused-parameter]
                                  const line_t caller_line)
                                               ^
locale.c:313:21: warning: unused variable 'category_name_lengths' [-Wunused-const-variable]
STATIC const Size_t category_name_lengths[] = {
                    ^
2 warnings generated.

For line 313 in locale.c:

commit a63ba983ed3db8a22e590abc43751d991c27d7a4
Author:     Karl Williamson <khw@cpan.org>
AuthorDate: Thu Jul 20 20:35:00 2023 -0600
Commit:     Karl Williamson <khw@cpan.org>
CommitDate: Mon Jul 24 04:10:34 2023 -0600

    locale.c: Avoid runtime strlen() calls

For line 408 in locale.c:

commit a2d04a5251e8e0c441a5c12ede6c00b49c7403b4
Author:     Karl Williamson <khw@cpan.org>
AuthorDate: Thu Apr 20 15:19:50 2023 -0600
Commit:     Karl Williamson <khw@cpan.org>
CommitDate: Mon Jul 24 04:10:34 2023 -0600

    locale.c: Refactor S_get_category_index()

@khwilliamson, can you take a look?

Thank you very much.
Jim Keenan

Metadata

Metadata

Assignees

No one assigned

    Labels

    build-time-warningsReplaces [META] Build-time warnings RT #133556

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions