diff --git a/meson.build b/meson.build index afb1acfb..cfdc8f7d 100644 --- a/meson.build +++ b/meson.build @@ -49,6 +49,7 @@ taisei_c_args = cc.get_supported_arguments( '-Winit-self', '-Wlogical-op', '-Wmissing-prototypes', + '-Wno-typedef-redefinition', '-Wno-long-long', '-Wnull-dereference', '-Wparentheses', @@ -56,8 +57,8 @@ taisei_c_args = cc.get_supported_arguments( '-Wsometimes-uninitialized', '-Wstrict-prototypes', '-Wtype-limits', - '-Wunneeded-internal-declaration', '-Wunreachable-code', + '-Wunneeded-internal-declaration', '-Wunreachable-code-loop-increment', ) diff --git a/src/entity.h b/src/entity.h index af9c19cf..95ca2bca 100644 --- a/src/entity.h +++ b/src/entity.h @@ -108,8 +108,6 @@ static inline attr_must_inline const char* ent_type_name(EntityType type) { #undef ENT_TYPE default: return "ENT_INVALID"; } - - UNREACHABLE; } #define ENT_TYPE_ID(typename) (_ENT_TYPEID_##typename) diff --git a/src/renderer/common/sprite_batch.c b/src/renderer/common/sprite_batch.c index e72b49ea..e963c6f6 100644 --- a/src/renderer/common/sprite_batch.c +++ b/src/renderer/common/sprite_batch.c @@ -183,7 +183,7 @@ void r_flush_sprites(void) { } static void _r_sprite_batch_add(Sprite *spr, const SpriteParams *params, SDL_RWops *stream) { - SpriteAttribs alignas(32) attribs; + SpriteAttribs attribs; r_mat_current(MM_MODELVIEW, attribs.transform); r_mat_current(MM_TEXTURE, attribs.tex_transform); diff --git a/src/util/compat.h b/src/util/compat.h index 8e0395e9..c375b0d5 100644 --- a/src/util/compat.h +++ b/src/util/compat.h @@ -215,7 +215,7 @@ typedef signed char schar; __attribute__ ((always_inline)) // Structure must not be initialized with an implicit (non-designated) initializer. -#if __has_attribute(designated_init) +#if __has_attribute(designated_init) && defined(TAISEI_BUILDCONF_USE_DESIGNATED_INIT) #define attr_designated_init \ __attribute__ ((designated_init)) #else diff --git a/src/util/meson.build b/src/util/meson.build index a0eb019a..d845da3c 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -23,6 +23,16 @@ if is_developer_build util_src += files('debug.c') endif +use_designated_init = cc.compiles(''' +struct { int dummy; } __attribute__((designated_init)) x; +''', name : '__attribute__((designated_init)) with -Werror', args : [ '-Wattributes', '-Werror' ] ) + +if use_designated_init + config.set('TAISEI_BUILDCONF_USE_DESIGNATED_INIT', true) +else + config.set('TAISEI_BUILDCONF_USE_DESIGNATED_INIT', false) +endif + if host_machine.system() == 'windows' # NOTE: Even if we ever build this with something like Midipix, we'd # probably still want to use the winapi implementation of this here. diff --git a/src/version.h b/src/version.h index 5d2d530b..3d010184 100644 --- a/src/version.h +++ b/src/version.h @@ -44,7 +44,11 @@ typedef struct TaiseiVersion { ) typedef enum { - VCMP_MAJOR, + // Start filling this enum from nonzero value. + // This would help avoid a warning on some compilers like + // those with EDG frontend. Actual values of VCMP_... + // don't matter, the thing which does matter is its order. + VCMP_MAJOR = 1, VCMP_MINOR, VCMP_PATCH, VCMP_TWEAK,