Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 May 2017 19:43:52 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 219126] devel/gdb: Add upstream commits to get rid of min/max macros, improving C++ compatibility
Message-ID:  <bug-219126-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D219126

            Bug ID: 219126
           Summary: devel/gdb: Add upstream commits to get rid of min/max
                    macros, improving C++ compatibility
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: freebsd-ports-bugs@FreeBSD.org
          Reporter: dim@FreeBSD.org
                CC: luca.pizzamiglio@gmail.com
                CC: luca.pizzamiglio@gmail.com
             Flags: maintainer-feedback?(luca.pizzamiglio@gmail.com)

Created attachment 182374
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D182374&action=
=3Dedit
Fix min/max macro usage in devel/gdb

I have been experimenting with a newer version of libc++ in the
projects/clang500-import branch, and it turns out that gdb has traditionally
defined their own min/max macros.  However, it compiles most of its .c file=
s as
C++, and min/max macros are not compatible with C++.

Due to a slightly different include order in newer versions of libc++, this=
 now
even leads to compilation errors like the following:

In file included from doublest.c:30:
In file included from build-gnulib/import/math.h:27:
In file included from /usr/include/c++/v1/math.h:310:
In file included from /usr/include/c++/v1/limits:112:
/usr/include/c++/v1/__undef_min_max:17:2: warning: : macro min is incompati=
ble
with C++. #undefing min [-W#warnings]
#warning: macro min is incompatible with C++.  #undefing min
 ^
/usr/include/c++/v1/__undef_min_max:29:2: warning: : macro max is incompati=
ble
with C++. #undefing max [-W#warnings]
#warning: macro max is incompatible with C++.  #undefing max
 ^
c++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is
deprecated [-Wdeprecated]
doublest.c:258:19: error: use of undeclared identifier 'min'; did you mean
'fmin'?
      mant_bits =3D min (mant_bits_left, 32);
                  ^~~
                  fmin
/usr/include/c++/v1/math.h:1221:1: note: 'fmin' declared here
fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
doublest.c:568:19: error: use of undeclared identifier 'min'; did you mean
'fmin'?
      mant_bits =3D min (mant_bits_left, 32);
                  ^~~
                  fmin
/usr/include/c++/v1/math.h:1221:1: note: 'fmin' declared here
fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
doublest.c:912:25: error: use of undeclared identifier 'min'; did you mean
'fmin'?
      memcpy (to, from, min (TYPE_LENGTH (from_type), TYPE_LENGTH (to_type)=
));
                        ^~~
                        fmin
/usr/include/c++/v1/math.h:1221:1: note: 'fmin' declared here
fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
2 warnings and 3 errors generated.

Upstream has also seen this problem with newer versions of GNU libstdc++, s=
o it
made the following two commits:

https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;a=3Dcommit;h=3D3=
25fac504a327de9c46a4e5cf9c88ece9d9d7701
("gdb: Use std::min and std::max throughout")

https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;a=3Dcommit;h=3D7=
68adc05c44c7e8b5c0f9ca5ad3ca96657715293
("gdb: Fix std::{min, max}-related build breakage on 32-bit hosts")

Here is a patch to add these two commits to our devel/gdb port.  I hope they
will no longer be necessary when a new gdb version is released.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-219126-13>