Merge pull request #10 from mtavenrath/fix_headers

Fix gcc/clang includes and warnings
This commit is contained in:
Andreas Süßenbach 2016-07-26 16:18:16 +02:00 committed by GitHub
commit dd2744eecf
2 changed files with 75 additions and 65 deletions

View File

@ -222,6 +222,7 @@ std::string const optionalClassHeader = (
); );
std::string const arrayProxyHeader = ( std::string const arrayProxyHeader = (
"#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE\n"
" template <typename T>\n" " template <typename T>\n"
" class ArrayProxy\n" " class ArrayProxy\n"
" {\n" " {\n"
@ -311,6 +312,7 @@ std::string const arrayProxyHeader = (
" uint32_t m_count;\n" " uint32_t m_count;\n"
" T * m_ptr;\n" " T * m_ptr;\n"
" };\n" " };\n"
"#endif\n"
"\n" "\n"
); );
@ -2337,14 +2339,14 @@ void writeStructConstructor( std::ofstream & ofs, std::string const& name, Struc
} }
else else
{ {
ofs << "std::array<" + structData.members[i].type + "," + structData.members[i].arraySize + "> const& " + structData.members[i].name << "_ = { " << defaultIt->second; ofs << "std::array<" + structData.members[i].type + "," + structData.members[i].arraySize + "> const& " + structData.members[i].name << "_ = { { " << defaultIt->second;
size_t n = atoi(structData.members[i].arraySize.c_str()); size_t n = atoi(structData.members[i].arraySize.c_str());
assert(0 < n); assert(0 < n);
for (size_t j = 1; j < n; j++) for (size_t j = 1; j < n; j++)
{ {
ofs << ", " << defaultIt->second; ofs << ", " << defaultIt->second;
} }
ofs << " }"; ofs << " } }";
} }
listedArgument = true; listedArgument = true;
} }
@ -2813,10 +2815,6 @@ void writeTypeStruct( std::ofstream & ofs, VkData const& vkData, DependencyData
<< " }" << std::endl << " }" << std::endl
<< std::endl; << std::endl;
} }
else
{
int a = 0;
}
// the member variables // the member variables
for (size_t i = 0; i < it->second.members.size(); i++) for (size_t i = 0; i < it->second.members.size(); i++)
@ -2877,7 +2875,7 @@ void writeTypeUnion( std::ofstream & ofs, VkData const& vkData, DependencyData c
} }
else else
{ {
ofs << " = { " << it->second << " }"; ofs << " = { {" << it->second << "} }";
} }
} }
ofs << " )" << std::endl ofs << " )" << std::endl
@ -3081,14 +3079,18 @@ int main( int argc, char **argv )
<< "#ifndef VULKAN_HPP" << std::endl << "#ifndef VULKAN_HPP" << std::endl
<< "#define VULKAN_HPP" << std::endl << "#define VULKAN_HPP" << std::endl
<< std::endl << std::endl
<< "#include <algorithm>" << std::endl
<< "#include <array>" << std::endl << "#include <array>" << std::endl
<< "#include <cassert>" << std::endl << "#include <cassert>" << std::endl
<< "#include <cstdint>" << std::endl << "#include <cstdint>" << std::endl
<< "#include <cstring>" << std::endl << "#include <cstring>" << std::endl
<< "#include <initializer_list>" << std::endl
<< "#include <string>" << std::endl << "#include <string>" << std::endl
<< "#include <system_error>" << std::endl << "#include <system_error>" << std::endl
<< "#include <type_traits>" << std::endl
<< "#include <vulkan/vulkan.h>" << std::endl << "#include <vulkan/vulkan.h>" << std::endl
<< "#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE" << std::endl << "#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE" << std::endl
<< "# include <memory>" << std::endl
<< "# include <vector>" << std::endl << "# include <vector>" << std::endl
<< "#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/" << std::endl << "#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/" << std::endl
<< std::endl; << std::endl;
@ -3131,12 +3133,14 @@ int main( int argc, char **argv )
<< std::endl << std::endl
<< "#endif" << std::endl; << "#endif" << std::endl;
} }
catch (std::exception e) catch (std::exception const& e)
{ {
std::cout << "caught exception: " << e.what() << std::endl; std::cout << "caught exception: " << e.what() << std::endl;
return -1;
} }
catch (...) catch (...)
{ {
std::cout << "caught unknown exception" << std::endl; std::cout << "caught unknown exception" << std::endl;
return -1;
} }
} }

View File

@ -52,14 +52,18 @@
#ifndef VULKAN_HPP #ifndef VULKAN_HPP
#define VULKAN_HPP #define VULKAN_HPP
#include <algorithm>
#include <array> #include <array>
#include <cassert> #include <cassert>
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
#include <initializer_list>
#include <string> #include <string>
#include <system_error> #include <system_error>
#include <type_traits>
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
# include <memory>
# include <vector> # include <vector>
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -216,6 +220,7 @@ namespace vk
RefType *m_ptr; RefType *m_ptr;
}; };
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename T> template <typename T>
class ArrayProxy class ArrayProxy
{ {
@ -305,6 +310,7 @@ namespace vk
uint32_t m_count; uint32_t m_count;
T * m_ptr; T * m_ptr;
}; };
#endif
enum class Result enum class Result
{ {
@ -2855,7 +2861,7 @@ namespace vk
union ClearColorValue union ClearColorValue
{ {
ClearColorValue( const std::array<float,4>& float32_ = { 0 } ) ClearColorValue( const std::array<float,4>& float32_ = { {0} } )
{ {
memcpy( &float32, float32_.data(), 4 * sizeof( float ) ); memcpy( &float32, float32_.data(), 4 * sizeof( float ) );
} }
@ -8156,7 +8162,7 @@ namespace vk
struct DebugMarkerMarkerInfoEXT struct DebugMarkerMarkerInfoEXT
{ {
DebugMarkerMarkerInfoEXT( const char* pMarkerName_ = nullptr, std::array<float,4> const& color_ = { 0, 0, 0, 0 } ) DebugMarkerMarkerInfoEXT( const char* pMarkerName_ = nullptr, std::array<float,4> const& color_ = { { 0, 0, 0, 0 } } )
: sType( StructureType::eDebugMarkerMarkerInfoEXT ) : sType( StructureType::eDebugMarkerMarkerInfoEXT )
, pNext( nullptr ) , pNext( nullptr )
, pMarkerName( pMarkerName_ ) , pMarkerName( pMarkerName_ )
@ -9655,7 +9661,7 @@ namespace vk
struct PipelineColorBlendStateCreateInfo struct PipelineColorBlendStateCreateInfo
{ {
PipelineColorBlendStateCreateInfo( PipelineColorBlendStateCreateFlags flags_ = PipelineColorBlendStateCreateFlags(), Bool32 logicOpEnable_ = 0, LogicOp logicOp_ = LogicOp::eClear, uint32_t attachmentCount_ = 0, const PipelineColorBlendAttachmentState* pAttachments_ = nullptr, std::array<float,4> const& blendConstants_ = { 0, 0, 0, 0 } ) PipelineColorBlendStateCreateInfo( PipelineColorBlendStateCreateFlags flags_ = PipelineColorBlendStateCreateFlags(), Bool32 logicOpEnable_ = 0, LogicOp logicOp_ = LogicOp::eClear, uint32_t attachmentCount_ = 0, const PipelineColorBlendAttachmentState* pAttachments_ = nullptr, std::array<float,4> const& blendConstants_ = { { 0, 0, 0, 0 } } )
: sType( StructureType::ePipelineColorBlendStateCreateInfo ) : sType( StructureType::ePipelineColorBlendStateCreateInfo )
, pNext( nullptr ) , pNext( nullptr )
, flags( flags_ ) , flags( flags_ )
@ -10766,7 +10772,7 @@ namespace vk
struct ImageBlit struct ImageBlit
{ {
ImageBlit( ImageSubresourceLayers srcSubresource_ = ImageSubresourceLayers(), std::array<Offset3D,2> const& srcOffsets_ = { Offset3D(), Offset3D() }, ImageSubresourceLayers dstSubresource_ = ImageSubresourceLayers(), std::array<Offset3D,2> const& dstOffsets_ = { Offset3D(), Offset3D() } ) ImageBlit( ImageSubresourceLayers srcSubresource_ = ImageSubresourceLayers(), std::array<Offset3D,2> const& srcOffsets_ = { { Offset3D(), Offset3D() } }, ImageSubresourceLayers dstSubresource_ = ImageSubresourceLayers(), std::array<Offset3D,2> const& dstOffsets_ = { { Offset3D(), Offset3D() } } )
: srcSubresource( srcSubresource_ ) : srcSubresource( srcSubresource_ )
, dstSubresource( dstSubresource_ ) , dstSubresource( dstSubresource_ )
{ {