increase min deployment for macOS 27 SDK
Add pseudo-test allowing to create wxFileConfig for any file This is convenient for testing problems, for example those found by OSS-Fuzz (see #26597).
Warn about multiple groups in wxFileConfig instead of asserting It's not clear whether we handle them correctly, and so it might be better to refuse input with duplicated groups entirely, but for now at least avoid asserting when encountering them.
Use earliest supported macOS version in configure by default Use the first value of DEPLOYMENT_TARGET_SUGGESTED_VALUES plist key instead of MACOSX_DEPLOYMENT_TARGET. Also drop support for using "buildSettings" key, this is something very old and certainly not used by any of the still supported Xcode versions. And simplify the commands used in a configure, in particular use a single sed command with "p" modifier instead of using grep and then sed.
Merge branch 'osx-macos-27' macOS 27 adaptions. Closes #26578.
Merge branch 'fileconfig-fixes' Fix assert on duplicate group in wxFileConfig. See #26654.
| ... | ... | @@ -5,6 +5,7 @@ WXTOOLKITUPPER = COCOA |
| 5 | 5 | |
| 6 | 6 | MACOSX_DEPLOYMENT_TARGET = 10.10
|
| 7 | 7 | MACOSX_DEPLOYMENT_TARGET[arch=arm64] = 11.0
|
| 8 | +MACOSX_DEPLOYMENT_TARGET[sdk=macosx27*] = 12.0
|
|
| 8 | 9 | |
| 9 | 10 | GCC_VERSION =
|
| 10 | 11 |
| ... | ... | @@ -1314,15 +1314,20 @@ if test "x$wxUSE_MACOSX_VERSION_MIN" = "xno"; then |
| 1314 | 1314 | elif test "x$wxUSE_MACOSX_VERSION_MIN" = "xyes"; then
|
| 1315 | 1315 | if test "x$wxUSE_MACOSX_SDK" != "x"; then
|
| 1316 | 1316 | AC_MSG_CHECKING([SDK deployment version])
|
| 1317 | -dnl We need to quote the next line where we don't need macros and do need [] in the regex
|
|
| 1318 | -[
|
|
| 1319 | - MACOSX_SDK_PLIST_VERSION_MIN=`defaults read "$wxUSE_MACOSX_SDK/SDKSettings" buildSettings | grep '^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}[^"]*"\{0,1\}; *$' | sed 's/^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}\([^"]*\)"\{0,1\} *; *$/\1/'`
|
|
| 1320 | -]
|
|
| 1321 | - # If that failed, try again with the new key
|
|
| 1317 | + defaultProperties=`defaults read "$wxUSE_MACOSX_SDK/SDKSettings" DefaultProperties`
|
|
| 1318 | + |
|
| 1319 | + dnl Take the first (earliest, because they are sorted) supported
|
|
| 1320 | + dnl deployment target from the SDKSettings.plist file and remove
|
|
| 1321 | + dnl leading spaces, quotes and trailing comma from it.
|
|
| 1322 | + MACOSX_SDK_PLIST_VERSION_MIN=`echo "$defaultProperties" | sed -n -e '1,/DEPLOYMENT_TARGET_SUGGESTED_VALUES/d; s/^ *//; s/"//g; s/,//p; q'`
|
|
| 1323 | + |
|
| 1324 | + dnl If DEPLOYMENT_TARGET_SUGGESTED_VALUES doesn't exist, as it was in
|
|
| 1325 | + dnl 10.11..10.13 SDKs, try MACOSX_DEPLOYMENT_TARGET instead.
|
|
| 1322 | 1326 | if test "x$MACOSX_SDK_PLIST_VERSION_MIN" = "x"; then
|
| 1323 | -[
|
|
| 1324 | - MACOSX_SDK_PLIST_VERSION_MIN=`defaults read "$wxUSE_MACOSX_SDK/SDKSettings" DefaultProperties | grep '^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}[^"]*"\{0,1\}; *$' | sed 's/^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}\([^"]*\)"\{0,1\} *; *$/\1/'`
|
|
| 1325 | -]
|
|
| 1327 | + dnl We need to quote the next line where we don't need macros and do need [] in the regex
|
|
| 1328 | + [
|
|
| 1329 | + MACOSX_SDK_PLIST_VERSION_MIN=`echo "$defaultProperties" | sed -n -e 's/^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}\([^"]*\)"\{0,1\} *; *$/\1/p'`
|
|
| 1330 | + ]
|
|
| 1326 | 1331 | fi
|
| 1327 | 1332 | |
| 1328 | 1333 | if test "x$MACOSX_SDK_PLIST_VERSION_MIN" != "x"; then
|
| ... | ... | @@ -1514,8 +1514,15 @@ void wxFileConfigGroup::SetLine(wxFileConfigLineList *pLine) |
| 1514 | 1514 | {
|
| 1515 | 1515 | // for a normal (i.e. not root) group this method shouldn't be called twice
|
| 1516 | 1516 | // unless we are resetting the line
|
| 1517 | - wxASSERT_MSG( !m_pParent || !m_pLine || !pLine,
|
|
| 1518 | - wxT("changing line for a non-root group?") );
|
|
| 1517 | + if ( m_pParent )
|
|
| 1518 | + {
|
|
| 1519 | + if ( m_pLine && pLine )
|
|
| 1520 | + {
|
|
| 1521 | + // It would be nice to give the line numbers but we don't have them
|
|
| 1522 | + // here easily.
|
|
| 1523 | + wxLogWarning(_("duplicate group '%s'"), Name());
|
|
| 1524 | + }
|
|
| 1525 | + }
|
|
| 1519 | 1526 | |
| 1520 | 1527 | m_pLine = pLine;
|
| 1521 | 1528 | }
|
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 | #include "wx/fileconf.h"
|
| 22 | 22 | #include "wx/sstream.h"
|
| 23 | 23 | #include "wx/log.h"
|
| 24 | +#include "wx/wfstream.h"
|
|
| 24 | 25 | |
| 25 | 26 | #include "testlog.h"
|
| 26 | 27 | |
| ... | ... | @@ -658,6 +659,30 @@ TEST_CASE_METHOD(LogTestCase, "wxFileConfig::Error", "[fileconfig][error]") |
| 658 | 659 | |
| 659 | 660 | // Check that it's the second quote which is unexpected, not the first one.
|
| 660 | 661 | checkWarning(R"(foo="x"y)", R"(unexpected " at position 3)");
|
| 662 | + |
|
| 663 | + // Check that a duplicate group is detected as an error.
|
|
| 664 | + checkWarning(R"([foo]
|
|
| 665 | +bar=1
|
|
| 666 | +[foo]
|
|
| 667 | +baz=2
|
|
| 668 | +)", "duplicate group 'foo'");
|
|
| 669 | +}
|
|
| 670 | + |
|
| 671 | +// This test is disabled by default as it requires the environment variable
|
|
| 672 | +// below to be defined to point to a XML file to load.
|
|
| 673 | +TEST_CASE("wxFileConfig::Load", "[.]")
|
|
| 674 | +{
|
|
| 675 | + wxString file;
|
|
| 676 | + REQUIRE( wxGetEnv("WX_TEST_FILECONFIG", &file) );
|
|
| 677 | + |
|
| 678 | + wxFileInputStream fis(file);
|
|
| 679 | + REQUIRE( fis.IsOk() );
|
|
| 680 | + |
|
| 681 | + std::unique_ptr<wxFileConfig> fc;
|
|
| 682 | + |
|
| 683 | + REQUIRE_NOTHROW( fc.reset(new wxFileConfig(fis)) );
|
|
| 684 | + |
|
| 685 | + WARN("Dump of " << file << ":\n" << Dump(*fc));
|
|
| 661 | 686 | }
|
| 662 | 687 | |
| 663 | 688 | #endif // wxUSE_FILECONFIG
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help