Browse Source

Use const char* const* for argv consistently.

Yay so much cruft removed.
pull/570/head
Vladimír Vondruš 4 years ago
parent
commit
384e148c24
  1. 4
      src/Magnum/Audio/Context.cpp
  2. 24
      src/Magnum/Audio/Context.h
  3. 2
      src/Magnum/Audio/al-info.cpp
  4. 4
      src/Magnum/GL/Context.cpp
  5. 6
      src/Magnum/GL/Context.h
  6. 36
      src/Magnum/Platform/GLContext.h
  7. 2
      src/Magnum/Vk/Implementation/InstanceState.cpp
  8. 4
      src/Magnum/Vk/Implementation/InstanceState.h
  9. 6
      src/Magnum/Vk/Instance.cpp
  10. 2
      src/Magnum/Vk/Instance.h
  11. 20
      src/Magnum/Vk/InstanceCreateInfo.h

4
src/Magnum/Audio/Context.cpp

@ -182,9 +182,9 @@ Context& Context::current() {
return *currentContext;
}
Context::Context(Int argc, const char** argv): Context(Configuration{}, argc, argv) {}
Context::Context(const Int argc, const char* const* const argv): Context(Configuration{}, argc, argv) {}
Context::Context(NoCreateT, Int argc, const char** argv) noexcept: _device{}, _context{} {
Context::Context(NoCreateT, const Int argc, const char* const* const argv) noexcept: _device{}, _context{} {
Utility::Arguments args{"magnum",
Utility::Arguments::Flag::IgnoreUnknownOptions};
args.addOption("log", "default").setHelp("log", "console logging", "default|quiet|verbose")

24
src/Magnum/Audio/Context.h

@ -205,25 +205,13 @@ class MAGNUM_AUDIO_EXPORT Context {
* Parses command-line arguments, and creates OpenAL context with given
* configuration.
*/
explicit Context(const Configuration& configuration, Int argc, const char** argv): Context(NoCreate, argc, argv) { create(configuration); }
/** @overload */
explicit Context(const Configuration& configuration, Int argc, char** argv): Context(configuration, argc, const_cast<const char**>(argv)) {}
/** @overload */
explicit Context(const Configuration& configuration, Int argc, std::nullptr_t argv): Context(configuration, argc, static_cast<const char**>(argv)) {}
explicit Context(const Configuration& configuration, Int argc, const char* const* argv): Context(NoCreate, argc, argv) { create(configuration); }
/** @overload */
explicit Context(const Configuration& configuration): Context(configuration, 0, nullptr) {}
/** @overload */
explicit Context(Int argc, const char** argv);
/** @overload */
explicit Context(Int argc, char** argv): Context(argc, const_cast<const char**>(argv)) {}
/** @overload */
explicit Context(Int argc, std::nullptr_t argv): Context(argc, static_cast<const char**>(argv)) {}
explicit Context(Int argc, const char* const* argv);
/** @overload */
explicit Context(): Context(0, nullptr) {}
@ -235,13 +223,7 @@ class MAGNUM_AUDIO_EXPORT Context {
* time, for example to do a more involved configuration. Call
* @ref create() or @ref tryCreate() to create the actual context.
*/
explicit Context(NoCreateT, Int argc, const char** argv) noexcept;
/** @overload */
explicit Context(NoCreateT, Int argc, char** argv) noexcept: Context(NoCreate, argc, const_cast<const char**>(argv)) {}
/** @overload */
explicit Context(NoCreateT, Int argc, std::nullptr_t argv) noexcept: Context(NoCreate, argc, static_cast<const char**>(argv)) {}
explicit Context(NoCreateT, Int argc, const char* const* argv) noexcept;
/** @overload */
explicit Context(NoCreateT) noexcept: Context{NoCreate, 0, nullptr} {}

2
src/Magnum/Audio/al-info.cpp

@ -107,7 +107,7 @@ Vendor extension support:
using namespace Magnum;
int main(const int argc, const char** const argv) {
int main(const int argc, const char* const* const argv) {
Utility::Arguments args;
args.addBooleanOption('s', "short").setHelp("short", "display just essential info and exit")
.addBooleanOption("extension-strings").setHelp("extension-strings", "list all extension strings provided by the driver (implies --short)")

4
src/Magnum/GL/Context.cpp

@ -689,9 +689,9 @@ Context& Context::current() {
void Context::makeCurrent(Context* context) { currentContext = context; }
Context::Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&)): Context{NoCreate, Utility::Arguments{"magnum"}, argc, argv, functionLoader} {}
Context::Context(NoCreateT, const Int argc, const char* const* const argv, void functionLoader(Context&)): Context{NoCreate, Utility::Arguments{"magnum"}, argc, argv, functionLoader} {}
Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader(Context&)): _functionLoader{functionLoader}, _version{Version::None} {
Context::Context(NoCreateT, Utility::Arguments& args, const Int argc, const char* const* const argv, void functionLoader(Context&)): _functionLoader{functionLoader}, _version{Version::None} {
/* Parse arguments */
CORRADE_INTERNAL_ASSERT(args.prefix() == "magnum");
args.addOption("disable-workarounds").setHelp("disable-workarounds", "driver workarounds to disable\n (see https://doc.magnum.graphics/magnum/opengl-workarounds.html for detailed info)", "LIST")

6
src/Magnum/GL/Context.h

@ -870,9 +870,9 @@ class MAGNUM_GL_EXPORT Context {
#endif
/* Made protected so it's possible to test the NoCreate constructor and
also not needed to friend Platform::GLContext. */
explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&));
explicit Context(NoCreateT, Utility::Arguments&& args, Int argc, const char** argv, void functionLoader(Context&)): Context{NoCreate, args, argc, argv, functionLoader} {}
explicit Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader(Context&));
explicit Context(NoCreateT, Int argc, const char* const* argv, void functionLoader(Context&));
explicit Context(NoCreateT, Utility::Arguments&& args, Int argc, const char* const* argv, void functionLoader(Context&)): Context{NoCreate, args, argc, argv, functionLoader} {}
explicit Context(NoCreateT, Utility::Arguments& args, Int argc, const char* const* argv, void functionLoader(Context&));
bool tryCreate(const Configuration& configuration);
void create(const Configuration& configuration);

36
src/Magnum/Platform/GLContext.h

@ -57,26 +57,20 @@ class GLContext: public GL::Context {
/**
* @brief Constructor
*
* Equivalent to calling @ref GLContext(NoCreateT, Int, const char**)
* Equivalent to calling @ref GLContext(NoCreateT, Int, const char* const*)
* followed by @ref create(const Configuration&).
*/
explicit GLContext(Int argc, const char** argv, const Configuration& configuration = {}): GLContext{NoCreate, argc, argv} {
explicit GLContext(Int argc, const char* const* argv, const Configuration& configuration = {}): GLContext{NoCreate, argc, argv} {
create(configuration);
}
/** @overload */
explicit GLContext(Int argc, char** argv, const Configuration& configuration = {}): GLContext{argc, const_cast<const char**>(argv), configuration} {}
/** @overload */
explicit GLContext(Int argc, std::nullptr_t argv, const Configuration& configuration = {}): GLContext{argc, static_cast<const char**>(argv), configuration} {}
/**
* @brief Default constructor
*
* Equivalent to passing @cpp {0, nullptr, configuration} @ce to
* @ref GLContext(Int, const char**, const Configuration&). Even if the
* command-line options are not propagated, it's still possible to
* affect the setup behavior from the environment or by passing a
* @ref GLContext(Int, const char* const*, const Configuration&). Even
* if the command-line options are not propagated, it's still possible
* to affect the setup behavior from the environment or by passing a
* @relativeref{GL::Context,Configuration} instance. See
* @ref GL-Context-usage for more information.
*/
@ -88,26 +82,18 @@ class GLContext: public GL::Context {
* Parses command-line arguments and sets @ref version() to
* @ref GL::Version::None, everything else is left in an empty state.
* Use @ref create() or @ref tryCreate() to create the context.
* @see @ref GLContext(Int, const char**, const Configuration&)
* @see @ref GLContext(Int, const char* const*, const Configuration&)
*/
explicit GLContext(NoCreateT, Int argc, const char** argv):
explicit GLContext(NoCreateT, Int argc, const char* const* argv):
#ifndef CORRADE_TARGET_EMSCRIPTEN
GL::Context{NoCreate, argc, argv, flextGLInit} {}
#else
GL::Context{NoCreate, argc, argv, nullptr} {}
#endif
/** @overload */
explicit GLContext(NoCreateT, Int argc, char** argv): GLContext{NoCreate, argc, const_cast<const char**>(argv)} {}
/** @overload */
explicit GLContext(NoCreateT, Int argc, std::nullptr_t argv): GLContext{NoCreate, argc, static_cast<const char**>(argv)} {}
#ifndef DOXYGEN_GENERATING_OUTPUT
/* Used privately to inject additional command-line arguments */
explicit GLContext(NoCreateT, Utility::Arguments& args, Int argc, char** argv): GLContext{NoCreate, args, argc, const_cast<const char**>(argv)} {}
explicit GLContext(NoCreateT, Utility::Arguments& args, Int argc, std::nullptr_t argv): GLContext{NoCreate, args, argc, static_cast<const char**>(argv)} {}
explicit GLContext(NoCreateT, Utility::Arguments& args, Int argc, const char** argv):
explicit GLContext(NoCreateT, Utility::Arguments& args, Int argc, const char* const* argv):
#ifndef CORRADE_TARGET_EMSCRIPTEN
GL::Context{NoCreate, args, argc, argv, flextGLInit} {}
#else
@ -119,7 +105,7 @@ class GLContext: public GL::Context {
* @brief Construct with creation delayed to later
*
* Equivalent to passing @cpp {NoCreate, 0, nullptr} @ce to
* @ref GLContext(NoCreateT, Int, const char**). Even if the
* @ref GLContext(NoCreateT, Int, const char* const*). Even if the
* command-line options are not propagated, it's still possible to
* affect the renderer behavior from the environment or by passing
* a @relativeref{GL::Context,Configuration} instance to @ref create()
@ -130,14 +116,14 @@ class GLContext: public GL::Context {
/**
* @brief Create the context
*
* Meant to be called on a @ref GLContext(NoCreateT, Int, char**) "NoCreate"'d
* Meant to be called on a @ref GLContext(NoCreateT, Int, const char* const*) "NoCreate"'d
* instance. Parses command-line arguments, loads OpenGL function
* pointers using a platform-specific API, does initial setup, detects
* available features and enables them throughout the engine. If
* detected version is unsupported or any other error occurs, a message
* is printed to output and the application exits. See @ref tryCreate()
* for an alternative.
* @see @ref GLContext(Int, char**, const Configuration&),
* @see @ref GLContext(Int, const char* const*, const Configuration&),
* @ref GL-Context-usage, @fn_gl{Get} with @def_gl{MAJOR_VERSION},
* @def_gl{MINOR_VERSION}, @def_gl{CONTEXT_FLAGS},
* @def_gl{NUM_EXTENSIONS}, @fn_gl{GetString} with

2
src/Magnum/Vk/Implementation/InstanceState.cpp

@ -27,6 +27,6 @@
namespace Magnum { namespace Vk { namespace Implementation {
InstanceState::InstanceState(Instance&, Int argc, const char** argv): argc{argc}, argv{argv} {}
InstanceState::InstanceState(Instance&, Int argc, const char* const* argv): argc{argc}, argv{argv} {}
}}}

4
src/Magnum/Vk/Implementation/InstanceState.h

@ -30,10 +30,10 @@
namespace Magnum { namespace Vk { namespace Implementation {
struct InstanceState {
explicit InstanceState(Instance& instance, Int argc, const char** argv);
explicit InstanceState(Instance& instance, Int argc, const char* const* argv);
Int argc;
const char** argv;
const char* const* argv;
/* There are currently no instance-level extension-dependent code paths.
Everything is currently in DeviceProperties internals, as

6
src/Magnum/Vk/Instance.cpp

@ -56,10 +56,10 @@ struct InstanceCreateInfo::State {
bool quietLog = false;
Version version = Version::None;
Int argc;
const char** argv;
const char* const* argv;
};
InstanceCreateInfo::InstanceCreateInfo(const Int argc, const char** const argv, const LayerProperties* const layerProperties, const InstanceExtensionProperties* extensionProperties, const Flags flags): _info{}, _applicationInfo{} {
InstanceCreateInfo::InstanceCreateInfo(const Int argc, const char* const* const argv, const LayerProperties* const layerProperties, const InstanceExtensionProperties* extensionProperties, const Flags flags): _info{}, _applicationInfo{} {
Utility::Arguments args = Implementation::arguments();
args.parse(argc, argv);
@ -364,7 +364,7 @@ template<class T> void Instance::initializeExtensions(const Containers::ArrayVie
}
}
void Instance::initialize(const Version version, const Int argc, const char** const argv) {
void Instance::initialize(const Version version, const Int argc, const char* const* const argv) {
/* Init version, function pointers */
_version = version;
flextVkInitInstance(_handle, &_functionPointers);

2
src/Magnum/Vk/Instance.h

@ -436,7 +436,7 @@ class MAGNUM_VK_EXPORT Instance {
private:
template<class T> MAGNUM_VK_LOCAL void initializeExtensions(Containers::ArrayView<const T> enabledExtensions);
MAGNUM_VK_LOCAL void initialize(Version version, Int argc, const char** argv);
MAGNUM_VK_LOCAL void initialize(Version version, Int argc, const char* const* argv);
VkInstance _handle;
HandleFlags _flags;

20
src/Magnum/Vk/InstanceCreateInfo.h

@ -54,7 +54,7 @@ class MAGNUM_VK_EXPORT InstanceCreateInfo {
* @brief Instance creation flag
*
* Wraps @type_vk_keyword{InstanceCreateFlagBits}.
* @see @ref Flags, @ref InstanceCreateInfo(Int, const char**, const LayerProperties*, const InstanceExtensionProperties*, Flags)
* @see @ref Flags, @ref InstanceCreateInfo(Int, const char* const*, const LayerProperties*, const InstanceExtensionProperties*, Flags)
*/
enum class Flag: UnsignedInt {
/* Any magnum-specific flags added here have to be filtered out
@ -77,7 +77,7 @@ class MAGNUM_VK_EXPORT InstanceCreateInfo {
* @brief Instance creation flags
*
* Type-safe wrapper for @type_vk_keyword{InstanceCreateFlags}.
* @see @ref InstanceCreateInfo(Int, const char**, const LayerProperties*, const InstanceExtensionProperties*, Flags)
* @see @ref InstanceCreateInfo(Int, const char* const*, const LayerProperties*, const InstanceExtensionProperties*, Flags)
*/
typedef Containers::EnumSet<Flag> Flags;
@ -110,22 +110,10 @@ class MAGNUM_VK_EXPORT InstanceCreateInfo {
Instance instance{argc, argv};
in which case all these overloads would need to be duplicated on
Instance as well. */
/*implicit*/ InstanceCreateInfo(Int argc, const char** argv, const LayerProperties* layerProperties, const InstanceExtensionProperties* const extensionProperties, Flags flags = {});
/*implicit*/ InstanceCreateInfo(Int argc, const char* const* argv, const LayerProperties* layerProperties, const InstanceExtensionProperties* const extensionProperties, Flags flags = {});
/** @overload */
/*implicit*/ InstanceCreateInfo(Int argc, char** argv, const LayerProperties* layerProperties, const InstanceExtensionProperties* extensionProperties, Flags flags = {}): InstanceCreateInfo{argc, const_cast<const char**>(argv), layerProperties, extensionProperties, flags} {}
/** @overload */
/*implicit*/ InstanceCreateInfo(Int argc, std::nullptr_t argv, const LayerProperties* layerProperties, const InstanceExtensionProperties* extensionProperties, Flags flags = {}): InstanceCreateInfo{argc, static_cast<const char**>(argv), layerProperties, extensionProperties, flags} {}
/** @overload */
/*implicit*/ InstanceCreateInfo(Int argc, const char** argv, Flags flags = {}): InstanceCreateInfo{argc, argv, nullptr, nullptr, flags} {}
/** @overload */
/*implicit*/ InstanceCreateInfo(Int argc, char** argv, Flags flags = {}): InstanceCreateInfo{argc, argv, nullptr, nullptr, flags} {}
/** @overload */
/*implicit*/ InstanceCreateInfo(Int argc, std::nullptr_t argv, Flags flags = {}): InstanceCreateInfo{argc, argv, nullptr, nullptr, flags} {}
/*implicit*/ InstanceCreateInfo(Int argc, const char* const* argv, Flags flags = {}): InstanceCreateInfo{argc, argv, nullptr, nullptr, flags} {}
/** @overload */
/*implicit*/ InstanceCreateInfo(Flags flags = {}): InstanceCreateInfo{0, nullptr, flags} {}

Loading…
Cancel
Save