pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: 2006Q1 audio/audacity fails to build on 3.0/amd64



> Why do you think that? Last time around, I checked, and it was a
> perfectly normally defined NULL.

The error message from gcc claims there is an ambiguous function call. I
have read the rules that C++ uses to disambiguate overloaded function
calls in the presence of multiple possible conversions of multiple
arguments, and they are horrible. Of the kind "you are not expected to
understand this".

So I believe gcc when it complains, even if it might be overly strict or
pedantic, and I want to fix the problem in a way that makes it easy for
anybody to determine which overloaded function to call, without needing
any subtilities in the rules if any may apply. My patch follows that
strategy.

c++ -c -O2 -I/usr/pkg/include -I/usr/include -DGLX_GLXEXT_LEGACY 
-I/usr/pkg/include/freetype2 -I/usr/X11R6/include 
-I../lib-src/portmixer/px_common -I../lib-src/soundtouch/include -O2 
-I/usr/pkg/include -I/usr/include -DGLX_GLXEXT_LEGACY 
-I/usr/pkg/include/freetype2 -I/usr/X11R6/include -I../lib-src/expat 
-I../lib-src/allegro -I../lib-src/libnyquist/nyx 
-I../lib-src/libresample/include -I/usr/pkg/include -I/usr/include 
-DGLX_GLXEXT_LEGACY -I/usr/pkg/include/freetype2 -I/usr/X11R6/include -Wall 
-Iinclude -I/usr/pkg/include -I/usr/include -DGLX_GLXEXT_LEGACY 
-I/usr/pkg/include/freetype2 -I/usr/X11R6/include 
-I/usr/pkg/lib/wx/include/gtk2-ansi-release-2.6 -I/usr/pkg/include/wx-2.6 
-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES     
effects/ToneGen.cpp -o obj/effects/ToneGen.o

effects/ToneGen.cpp: In function `wxSizer* CreateToneGenDialog(wxWindow*, bool,
   bool)':
effects/ToneGen.cpp:268: error: ISO C++ says that `
   wxChoice::wxChoice(wxWindow*, int, const wxPoint&, const wxSize&, int, const
   wxString*, long int, const wxValidator&, const wxString&)' and `
   wxChoice::wxChoice(wxWindow*, int, const wxPoint&, const wxSize&, const
   wxArrayString&, long int, const wxValidator&, const wxString&)' are
   ambiguous even though the worst conversion for the former is better than the
   worst conversion for the latter

It is obvious that the function (constructor) signatures from the
message are ambiguous (if only in the sense of somewhat confusing to the
human reader), if you take into account that the first 4 arguments are
identical in type, and the last arguments have default values, i.e.  can
be omitted. The call specifies only 6 of the possible 9 or 8 arguments.
Apparently it does not matter to gcc that 0 had a very bad conversion to
const wxArrayString& and NULL a very bad conversion to long.

Hacking the options -E -dD onto the command line, to verify the
expansion of #defines, shows

# 11 "/pkg_comp/obj/pkgsrc/audio/audacity/default/.buildlink/include/wx-2.6/wx/g
tk/choice.h"
...
    wxChoice( wxWindow *parent, wxWindowID id,
            const wxPoint& pos = wxDefaultPosition,
            const wxSize& size = wxDefaultSize,
            int n = 0, const wxString choices[] = (const wxString *) __null,
            long style = 0,
            const wxValidator& validator = wxDefaultValidator,
            const wxString& name = wxChoiceNameStr )
...
    wxChoice( wxWindow *parent, wxWindowID id,
            const wxPoint& pos,
            const wxSize& size,
            const wxArrayString& choices,
            long style = 0,
            const wxValidator& validator = wxDefaultValidator,
            const wxString& name = wxChoiceNameStr )

# 11 "/usr/include/sys/null.h" 3 4 
#define NULL __null
...
   wxChoice *item4 = new wxChoice(parent, 10001, wxDefaultPosition,
                                  wxSize(80, -1), 0, __null);

Note that NULL in <sys/null.h> on amd64 is defined differently than on
i386 (__null resp. 0).

So, I stand by my assertion that the patch is needed because gcc
complains legitimately, and even if the complaint were an error of gcc,
it would need to be worked around. (The same for multimedia/vlc)

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert      -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl        -- Cetero censeo "authored" delendum esse.



Home | Main Index | Thread Index | Old Index