Bug 255796 - multimedia/smpeg: fix incorrect clang warning suppression flag.
Summary: multimedia/smpeg: fix incorrect clang warning suppression flag.
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jose Alonso Cardenas Marquez
URL:
Keywords:
Depends on:
Blocks: 255570
  Show dependency treegraph
 
Reported: 2021-05-11 15:24 UTC by Dimitry Andric
Modified: 2021-05-29 14:13 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (acm)


Attachments
Use -Wno-c++11-narrowing instead of -Wno-error-narrowing (685 bytes, text/plain)
2021-05-11 15:24 UTC, Dimitry Andric
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2021-05-11 15:24:51 UTC
Created attachment 224853 [details]
Use -Wno-c++11-narrowing instead of -Wno-error-narrowing

During an exp-run for llvm 12 (see bug 255570), it turned out that multimedia/smpeg does not build with clang 12.0.0 [1]:

libtool: compile:  c++ -DPACKAGE=\"smpeg\" -DVERSION=\"0.4.4\" -I. -I. -O2 -pipe -Wno-error-narrowing -fstack-protector-strong -fno-strict-aliasing -I/usr/local/include/SDL -I/usr/local/include -D_REENTRANT -D_THREAD_SAFE -DTHREADED_AUDIO -DNDEBUG -I.. -DNOCONTROLS -I.. -I../audio -I../video -fno-exceptions -fno-rtti -c huffmantable.cpp  -fPIC -DPIC -o .libs/huffmantable.o
warning: unknown -Werror warning specifier: '-Wno-error-narrowing' [-Wunknown-warning-option]
In file included from huffmantable.cpp:12:
../MPEGaudio.h:129:7: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
      register int r=(buffer[bitindex>>3]>>(7-(bitindex&7)))&1;
      ^~~~~~~~~
../MPEGaudio.h:135:7: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
      register unsigned short a;
      ^~~~~~~~~
huffmantable.cpp:553:8: error: constant expression evaluates to -1 which cannot be narrowed to type 'unsigned int' [-Wc++11-narrowing]
  { 0, 0-1, 0-1, 0,  0, htd33},
       ^~~
huffmantable.cpp:553:8: note: insert an explicit cast to silence this issue
  { 0, 0-1, 0-1, 0,  0, htd33},
       ^~~
[... more of these ...]

The Makefile attempts to suppress these warnings by adding -Wno-error-narrowing to CFLAGS, in case clang is used, but this warning suppression flag does not exist. It is called -Wno-c++11-narrowing instead, and the attached patch renames the flag.

Note that it might be better to compile all of the port with -std=gnu++98 since it is very old C++ code, but it does not seem to respect USE_CXXSTD=gnu++98, as the configure scripts are also pretty old. Better not try to mess with it too much...

[1] http://package22.nyi.freebsd.org/data/mainamd64PR255570-default/2021-05-08_16h02m24s/logs/smpeg-0.4.4_15.log
Comment 1 commit-hook freebsd_committer freebsd_triage 2021-05-29 14:09:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4fb035a886d9d247742f983fdd0afb703cabd975

commit 4fb035a886d9d247742f983fdd0afb703cabd975
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-05-11 11:37:28 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-05-29 14:08:18 +0000

    multimedia/smpeg: fix incorrect warning suppression flag.

    During an exp-run for llvm 12 (see bug 255570), it turned out that
    multimedia/smpeg does not build with clang 12.0.0:

    libtool: compile:  c++ -DPACKAGE=\"smpeg\" -DVERSION=\"0.4.4\" -I. -I. -O2 -pipe -Wno-error-narrowing -fstack-protector-strong -fno-strict-aliasing -I/usr/local/include/SDL -I/usr/local/include -D_REENTRANT -D_THREAD_SAFE -DTHREADED_AUDIO -DNDEBUG -I.. -DNOCONTROLS -I.. -I../audio -I../video -fno-exceptions -fno-rtti -c huffmantable.cpp  -fPIC -DPIC -o .libs/huffmantable.o
    warning: unknown -Werror warning specifier: '-Wno-error-narrowing' [-Wunknown-warning-option]
    In file included from huffmantable.cpp:12:
    ../MPEGaudio.h:129:7: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
          register int r=(buffer[bitindex>>3]>>(7-(bitindex&7)))&1;
          ^~~~~~~~~
    ../MPEGaudio.h:135:7: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
          register unsigned short a;
          ^~~~~~~~~
    huffmantable.cpp:553:8: error: constant expression evaluates to -1 which cannot be narrowed to type 'unsigned int' [-Wc++11-narrowing]
      { 0, 0-1, 0-1, 0,  0, htd33},
           ^~~
    huffmantable.cpp:553:8: note: insert an explicit cast to silence this issue
      { 0, 0-1, 0-1, 0,  0, htd33},
           ^~~
    [... more of these ...]

    The Makefile attempts to suppress these warnings by adding
    -Wno-error-narrowing to CFLAGS, in case clang is used, but this warning
    suppression flag does not exist. It is called -Wno-c++11-narrowing
    instead, and the attached patch renames the flag.

    Approved by:    maintainer timeout (2 weeks)
    PR:             255796
    MFH:            2021Q2

 multimedia/smpeg/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)