Skip to content

Commit

Permalink
Remove random unneeded <string> and StringStl.h includes.
Browse files Browse the repository at this point in the history
Or document why is it still needed.
  • Loading branch information
mosra committed Dec 31, 2022
1 parent e19373e commit c5fbb8a
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 28 deletions.
1 change: 0 additions & 1 deletion doc/snippets/MagnumVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
DEALINGS IN THE SOFTWARE.
*/

#include <string>
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StringIterable.h>
Expand Down
2 changes: 1 addition & 1 deletion src/Magnum/GL/Test/ContextGLTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <sstream>
#include <Corrade/Containers/ScopeGuard.h>
#include <Corrade/Containers/StringIterable.h>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/StringStl.h> /* contains() on std::string */
#include <Corrade/Containers/StringView.h>
#include <Corrade/TestSuite/Compare/Numeric.h>

Expand Down
3 changes: 1 addition & 2 deletions src/Magnum/Platform/WindowlessEglApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

#include "WindowlessEglApplication.h"

#include <cstring> /** @todo used by extensionSupported(), cleann up */
#include <string>
#include <cstring> /** @todo used by extensionSupported(), clean up */
#include <Corrade/Utility/Arguments.h>
#include <Corrade/Utility/Assert.h>
#include <Corrade/Utility/Debug.h>
Expand Down
1 change: 0 additions & 1 deletion src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/

#include <Corrade/Containers/String.h>
#include <Corrade/Containers/StringStl.h> /** @todo remove when AbstractImporter is <string>-free */
#include <Corrade/PluginManager/AbstractManager.h>
#include <Corrade/Utility/Path.h>

Expand Down
1 change: 0 additions & 1 deletion src/Magnum/Trade/AbstractImageConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <Corrade/Containers/EnumSet.hpp>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StringView.h>
#include <Corrade/Containers/StringStl.h> /** @todo remove once PluginManager is <string>-free */
#include <Corrade/PluginManager/Manager.hpp>
#include <Corrade/Utility/Assert.h>
#include <Corrade/Utility/Path.h>
Expand Down
2 changes: 1 addition & 1 deletion src/Magnum/Trade/Test/MaterialDataTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <algorithm> /* std::next_permutation() */
#include <sstream>
#include <Corrade/Containers/StaticArray.h>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/StringStl.h> /* partition() on a std::string */
#include <Corrade/TestSuite/Tester.h>
#include <Corrade/TestSuite/Compare/Container.h>
#include <Corrade/TestSuite/Compare/Numeric.h>
Expand Down
2 changes: 1 addition & 1 deletion src/Magnum/Trade/Test/PbrClearCoatMaterialDataTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

#include <sstream>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/String.h>
#include <Corrade/TestSuite/Tester.h>
#include <Corrade/Utility/DebugStl.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

#include <sstream>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/String.h>
#include <Corrade/TestSuite/Tester.h>
#include <Corrade/Utility/DebugStl.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

#include <sstream>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/String.h>
#include <Corrade/TestSuite/Tester.h>
#include <Corrade/Utility/DebugStl.h>

Expand Down
2 changes: 1 addition & 1 deletion src/Magnum/Trade/Test/PhongMaterialDataTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

#include <sstream>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/String.h>
#include <Corrade/TestSuite/Tester.h>
#include <Corrade/Utility/DebugStl.h>

Expand Down
1 change: 0 additions & 1 deletion src/Magnum/Vk/Test/DevicePropertiesVkTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <sstream>
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/StringIterable.h>
#include <Corrade/Containers/StringView.h>
#include <Corrade/TestSuite/Compare/Numeric.h>
Expand Down
21 changes: 14 additions & 7 deletions src/Magnum/Vk/Test/DeviceVkTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StringIterable.h>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/StringStl.h> /* StringHasPrefix */
#include <Corrade/TestSuite/Compare/Numeric.h>
#include <Corrade/TestSuite/Compare/String.h>
#include <Corrade/Utility/DebugStl.h>
#include <Corrade/Utility/FormatStl.h>

Expand Down Expand Up @@ -785,11 +786,14 @@ void DeviceVkTest::constructExtensionsCommandLineDisable() {
UnsignedInt major = versionMajor(deviceProperties.version());
UnsignedInt minor = versionMinor(deviceProperties.version());
UnsignedInt patch = versionPatch(deviceProperties.version());
/* SwiftShader reports just 1.1 with no patch version, special-case that */
std::string expected = Utility::formatString(data.log, deviceProperties.name(), major, minor, patch ? Utility::formatString(".{}", patch) : "", deviceProperties.driverName(), deviceProperties.driverInfo());
/* The output might contain a device workaround list, cut that away.
That's tested thoroughly in constructWorkaroundsCommandLineDisable(). */
CORRADE_COMPARE(out.str().substr(0, expected.size()), expected);
CORRADE_COMPARE_AS(out.str(),
Utility::format(data.log, deviceProperties.name(), major, minor,
/* SwiftShader reports just 1.1 with no patch version, special-case
that */
patch ? Utility::format(".{}", patch) : "", deviceProperties.driverName(), deviceProperties.driverInfo()),
TestSuite::Compare::StringHasPrefix);

/* Verify that the entrypoint is actually (not) loaded as expected, to
avoid all the above reporting being just smoke & mirrors */
Expand Down Expand Up @@ -842,11 +846,14 @@ void DeviceVkTest::constructExtensionsCommandLineEnable() {
UnsignedInt major = versionMajor(deviceProperties.version());
UnsignedInt minor = versionMinor(deviceProperties.version());
UnsignedInt patch = versionPatch(deviceProperties.version());
/* SwiftShader reports just 1.1 with no patch version, special-case that */
std::string expected = Utility::formatString(data.log, deviceProperties.name(), major, minor, patch ? Utility::formatString(".{}", patch) : "", deviceProperties.driverName(), deviceProperties.driverInfo());
/* The output might contain a device workaround list, cut that away.
That's tested thoroughly in constructWorkaroundsCommandLineDisable(). */
CORRADE_COMPARE(out.str().substr(0, expected.size()), expected);
CORRADE_COMPARE_AS(out.str(),
Utility::format(data.log, deviceProperties.name(), major, minor,
/* SwiftShader reports just 1.1 with no patch version, special-case
that */
patch ? Utility::format(".{}", patch) : "", deviceProperties.driverName(), deviceProperties.driverInfo()),
TestSuite::Compare::StringHasPrefix);

/* Verify that the entrypoint is actually (not) loaded as expected, to
avoid all the above reporting being just smoke & mirrors */
Expand Down
4 changes: 1 addition & 3 deletions src/Magnum/Vk/Test/ExtensionPropertiesVkTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include <sstream>
#include <Corrade/Containers/StringIterable.h>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/TestSuite/Tester.h>
#include <Corrade/TestSuite/Compare/Numeric.h>
#include <Corrade/Utility/DebugStl.h>
Expand Down Expand Up @@ -169,8 +168,7 @@ void ExtensionPropertiesVkTest::instanceExtensionIsSupported() {
CORRADE_VERIFY(!properties.isSupported("ZZZZZ"));

/* Verify that we're not just comparing a prefix */
const std::string extension = std::string(properties.name(0)) + "_hello";
CORRADE_VERIFY(!properties.isSupported(extension));
CORRADE_VERIFY(!properties.isSupported(properties.name(0) + "_hello"_s));

/* This extension should be available almost always */
if(!properties.isSupported("VK_KHR_get_physical_device_properties2"))
Expand Down
4 changes: 2 additions & 2 deletions src/Magnum/Vk/Test/InstanceVkTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <sstream>
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/StringIterable.h>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/String.h>
#include <Corrade/TestSuite/Tester.h>
#include <Corrade/TestSuite/Compare/Numeric.h>
#include <Corrade/Utility/DebugStl.h>
Expand Down Expand Up @@ -432,7 +432,7 @@ void InstanceVkTest::constructCommandLineEnable() {
UnsignedInt minor = versionMinor(enumerateInstanceVersion());
UnsignedInt patch = versionPatch(enumerateInstanceVersion());
/* Vulkan 1.0 instances report no patch version, special-case that */
CORRADE_COMPARE(out.str(), Utility::formatString(data.log, major, minor, patch ? Utility::formatString(".{}", patch) : ""));
CORRADE_COMPARE(out.str(), Utility::formatString(data.log, major, minor, patch ? Utility::format(".{}", patch) : ""));

/* Verify that the entrypoint is actually (not) loaded as expected, to
avoid all the above reporting being just smoke & mirrors */
Expand Down
4 changes: 1 addition & 3 deletions src/Magnum/Vk/Test/LayerPropertiesVkTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/

#include <sstream>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/TestSuite/Tester.h>
#include <Corrade/TestSuite/Compare/Numeric.h>
#include <Corrade/Utility/DebugStl.h>
Expand Down Expand Up @@ -136,8 +135,7 @@ void LayerPropertiesVkTest::isSupported() {
}

/* Verify that we're not just comparing a prefix */
const std::string layer = std::string(properties.name(0)) + "_hello";
CORRADE_VERIFY(!properties.isSupported(layer));
CORRADE_VERIFY(!properties.isSupported(properties.name(0) + "_hello"_s));
}

}}}}
Expand Down
1 change: 0 additions & 1 deletion src/Magnum/Vk/VulkanTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include "VulkanTester.h"

#include <string> /* sigh, for setSkippedArgumentPrefixes() */
#include <Corrade/Containers/StringView.h>

#include "Magnum/Vk/DeviceCreateInfo.h"
Expand Down

0 comments on commit c5fbb8a

Please sign in to comment.