Opened 15 months ago
Last modified 14 months ago
#67934 assigned defect
edid-decode @20230804: error: use of undeclared identifier 'nullptr'
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | wwalexander (William Alexander) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.8.1 |
Keywords: | Cc: | ||
Port: | edid-decode |
Description
edid-decode.cpp:303:22: error: no member named 'to_string' in namespace 'std' unsigned len = std::to_string(cta.preparsed_total_dtds).length(); ~~~~~^ edid-decode.cpp:601:19: error: no member named 'to_string' in namespace 'std' add_str(s, std::to_string(t->hsize_mm) + " mm x " + std::to_string(t->vsize_mm) + " mm"); ~~~~~^ edid-decode.cpp:601:60: error: no member named 'to_string' in namespace 'std' add_str(s, std::to_string(t->hsize_mm) + " mm x " + std::to_string(t->vsize_mm) + " mm"); ~~~~~^ edid-decode.cpp:1652:3: error: use of undeclared identifier 'nullptr' nullptr ^ edid-decode.cpp:1662:17: error: use of undeclared identifier 'nullptr' if (opt_str == nullptr && opt != CVT_INTERLACED && opt != CVT_ALT && ^ edid-decode.cpp:1671:28: error: use of undeclared identifier 'nullptr' *value = strtod(opt_str, nullptr); ^
The mention of nullptr
makes clear that this software requires C++11, and the compiler hasn't been told to use C++11 mode.
The solution will probably be something like:
compiler.cxx_standard 2011 configure.cxxflags-append -std=c++11
Change History (6)
comment:1 Changed 15 months ago by wwalexander (William Alexander)
comment:2 Changed 15 months ago by ryandesign (Ryan Carsten Schmidt)
You can test on older systems using an older Mac or a virtual machine running on a newer Mac. But even though I have both of these I usually don't bother. If a change seems likely to fix a problem, I often just commit it and later check to see if that fixed the build on the buildbot. I like monitoring the buildbot waterfall but build status eventually makes its way into the ports web site too.
comment:3 Changed 15 months ago by ryandesign (Ryan Carsten Schmidt)
Owner: | set to wwalexander |
---|---|
Status: | new → assigned |
See my comment above.
Also, sometimes you don't need an older system to verify a fix. For example, here we know nullptr
is a C++11 feature, so we need to ensure a C++11 compiler is used and that it is told to be in C++11 mode.
compiler.cxx_standard 2011
ensures the former, presuming that the build system correctly uses CXX
to invoke the C++ compiler. You can test whether this is the case on any OS version by doing a build and specifying a nonstandard compiler, for example sudo port build edid-decode configure.compiler=macports-clang-16
, then grep
ing through the log to make sure that every compilation happened via that compiler (/opt/local/bin/clang++-mp-16
).
configure.cxxflags-append -std=c++11
ensures the latter, presuming that the build system correctly passes CXXFLAGS
to every C++ compiler invocation. You can test whether this is the case on any OS version by doing a build and then grep
ing through the log for any occurrences of bin/clang++
that do not also include -std=c++11
. Looking at the project's Makefile, it looks like it does not use CXXFLAGS
; it erroneously passes CFLAGS
to the C++ compiler. Upstream should fix this.
Upstream should also be adding -std=c++11
to CXXFLAGS
in the Makefile without us having to do it.
comment:4 Changed 14 months ago by William Alexander <wwalexander@…>
comment:5 Changed 14 months ago by William Alexander <wwalexander@…>
comment:6 Changed 14 months ago by wwalexander (William Alexander)
This should be fixed by https://github.com/macports/macports-ports/pull/20270. Could you verify?
I've updated the Portfile with the suggested lines. What's the best way if any to test the behavior on older systems? Thank you for the guidance!