Tue, 20 May 2025 19:29:20 +0200
remove GCC attributes which are rarely helpful - resolves #663
--- a/src/ascension/camera.h Fri May 16 08:04:23 2025 +0200 +++ b/src/ascension/camera.h Tue May 20 19:29:20 2025 +0200 @@ -75,12 +75,10 @@ bool viewport_clear; }; -__attribute__((__nonnull__)) void asc_camera_init_(AscCamera *camera, struct asc_camera_init_args args); #define asc_camera_init(camera,...) asc_camera_init_(camera, (struct asc_camera_init_args){__VA_ARGS__}) -__attribute__((__nonnull__)) void asc_camera_ortho(AscCamera *camera, asc_recti rect); /** @@ -94,7 +92,6 @@ * @param camera the camera * @param size the new size */ -__attribute__((__nonnull__)) void asc_camera_ortho_update_size(AscCamera *camera, asc_vec2u size); #endif //ASCENSION_CAMERA_H
--- a/src/ascension/glcontext.h Fri May 16 08:04:23 2025 +0200 +++ b/src/ascension/glcontext.h Tue May 20 19:29:20 2025 +0200 @@ -69,17 +69,14 @@ #define ASC_TEXTURE_RECT_EMPTY_1X1 (&asc_active_glctx->textures_rect[ASC_TEXTURE_RECT_EMPTY_1X1_IDX]) #define ASC_SHADER_SPRITE (&asc_active_glctx->shader.sprite) -__attribute__((__nonnull__, __warn_unused_result__)) bool asc_gl_context_initialize( AscGLContext *ctx, SDL_Window *window, AscGLContextSettings const *settings ); -__attribute__((__nonnull__)) void asc_gl_context_destroy(AscGLContext *ctx); -__attribute__((__nonnull__)) static inline void asc_gl_context_activate(AscGLContext *ctx) { SDL_GL_MakeCurrent(ctx->window, ctx->glctx); }
--- a/src/ascension/scene.h Fri May 16 08:04:23 2025 +0200 +++ b/src/ascension/scene.h Tue May 20 19:29:20 2025 +0200 @@ -42,7 +42,6 @@ * @param scene the scene graph * @param camera_params initial camera parameters */ -__attribute__((__nonnull__)) void asc_scene_init_(AscScene *scene, struct asc_camera_init_args camera_params); /** @@ -60,7 +59,6 @@ * * @param scene the scene graph */ -__attribute__((__nonnull__)) void asc_scene_destroy(AscScene *scene); /** @@ -68,7 +66,6 @@ * * @param scene the scene graph */ -__attribute__((__nonnull__)) static inline AscCamera *asc_scene_camera(AscScene *scene) { return &scene->camera; } @@ -82,10 +79,8 @@ * * @param scene the scene graph */ -__attribute__((__nonnull__)) void asc_scene_draw(AscScene *scene); -__attribute__((__nonnull__)) void asc_scene_add_node(AscScene *scene, AscSceneNode *node); #endif // ASCENSION_SCENE_H
--- a/src/ascension/scene_node.h Fri May 16 08:04:23 2025 +0200 +++ b/src/ascension/scene_node.h Tue May 20 19:29:20 2025 +0200 @@ -152,7 +152,6 @@ * @param parent the (new) parent * @param node the node to link */ -__attribute__((__nonnull__)) void asc_scene_node_link( AscSceneNode *restrict parent, AscSceneNode *restrict node @@ -166,13 +165,10 @@ * * @param node the node to unlink */ -__attribute__((__nonnull__)) void asc_scene_node_unlink(AscSceneNode *node); -__attribute__((__nonnull__)) void asc_node_update(AscSceneNode *node); -__attribute__((__nonnull__)) void asc_node_update_transform(AscSceneNode *node); @@ -182,28 +178,24 @@ */ #define ASC_SCENE_2D_DEPTH_OFFSET 0.0078125f -__attribute__((__nonnull__)) static inline -void asc_set_position(AscSceneNode *node, float x, float y, float z) { +ASC_TRANFORM_FUNC void asc_set_position(AscSceneNode *node, float x, float y, float z) { node->position.x = x; node->position.y = y; node->position.z = z; asc_node_update_transform(node); } -__attribute__((__nonnull__)) static inline -void asc_set_position2d(AscSceneNode *node, int x, int y) { +ASC_TRANFORM_FUNC void asc_set_position2d(AscSceneNode *node, int x, int y) { node->position.x = (float)x; node->position.y = (float)y; asc_node_update_transform(node); } -__attribute__((__nonnull__)) static inline -asc_vec2i asc_get_position2d(AscSceneNode *node) { +ASC_TRANFORM_FUNC asc_vec2i asc_get_position2d(AscSceneNode *node) { return asc_vec2i_new(node->position.x, node->position.y); } -__attribute__((__nonnull__)) static inline -void asc_set_scale(AscSceneNode *node, float width, float height, float depth) { +ASC_TRANFORM_FUNC void asc_set_scale(AscSceneNode *node, float width, float height, float depth) { node->scale.width = width; node->scale.height = height; node->scale.depth = depth;
--- a/src/ascension/texture.h Fri May 16 08:04:23 2025 +0200 +++ b/src/ascension/texture.h Tue May 20 19:29:20 2025 +0200 @@ -67,7 +67,6 @@ ASC_TEXTURE_SCALE_REPEAT }; -__attribute__((__nonnull__)) void asc_texture_init( AscTexture *tex, unsigned count, @@ -76,7 +75,6 @@ enum asc_texture_mag_filter mag_filter ); -__attribute__((__nonnull__)) void asc_texture_destroy(AscTexture *tex, unsigned count); #define asc_texture_init_rectangle(tex, count) \ @@ -87,13 +85,10 @@ asc_texture_init(tex, count, ASC_TEXTURE_2D, \ ASC_TEXTURE_MIN_FILTER_LINEAR, ASC_TEXTURE_MAG_FILTER_LINEAR) -__attribute__((__nonnull__)) void asc_texture_bind(AscTexture const *tex, int uniform_location, int unit); -__attribute__((__nonnull__)) void asc_texture_from_surface(AscTexture *tex, SDL_Surface const *surface); -__attribute__((__nonnull__)) void asc_texture_from_file(AscTexture *tex, const char *name);
--- a/src/ascension/transform.h Fri May 16 08:04:23 2025 +0200 +++ b/src/ascension/transform.h Tue May 20 19:29:20 2025 +0200 @@ -35,12 +35,10 @@ #define ASC_TRANSFORM_SIZE (sizeof(float)*16) #ifdef __GNUC__ -#define ASC_TRANFORM_FUNC_ATTRIBUTES \ - __attribute__((__nonnull__, __always_inline__)) +#define ASC_TRANFORM_FUNC __attribute__((__always_inline__)) static inline #else -#define ASC_TRANFORM_FUNC_ATTRIBUTES +#define ASC_TRANFORM_FUNC static inline #endif -#define ASC_TRANFORM_FUNC ASC_TRANFORM_FUNC_ATTRIBUTES static inline ASC_TRANFORM_FUNC void asc_transform_identity(asc_transform transform) {
--- a/src/ascension/ui/text.h Fri May 16 08:04:23 2025 +0200 +++ b/src/ascension/ui/text.h Tue May 20 19:29:20 2025 +0200 @@ -104,11 +104,11 @@ * * @param node the text node */ -__attribute__((__nonnull__)) static inline void asc_text_alignment( AscSceneNode *node, enum asc_text_alignment alignment ) { + // TODO: does not need to be static asc_set_flag_masked(node->flags, ASC_TEXT_ALIGNMENT_MASK, alignment); asc_node_update(node); } @@ -119,11 +119,11 @@ * @param node the text node * @param centered true when the text shall be centered */ -__attribute__((__nonnull__)) static inline void asc_text_centered( AscSceneNode *node, bool centered ) { + // TODO: does not need to be static if (centered) { asc_clear_flag(node->flags, ASC_TEXT_ALIGN_CENTERED); } else { @@ -138,22 +138,21 @@ * @param node the text node * @param max_width the new maximum width */ -__attribute__((__nonnull__)) static inline void asc_text_max_width( AscSceneNode *node, unsigned max_width ) { + // TODO: does not need to be static ((AscText*)node)->max_width = max_width; asc_node_update(node); } /** - * + * TODO: docstring * @param node * @param format * @param ... */ -__attribute__((__nonnull__)) void asc_text_printf( AscSceneNode *node, char const* format,