Merge branch 'function-annotations' into 'master'

Annotate gsk_rounded_rect_is_circular as pure

See merge request GNOME/gtk!3952
This commit is contained in:
Matthias Clasen 2021-09-14 21:39:48 +00:00
commit ec6228b3a4
15 changed files with 85 additions and 88 deletions

View File

@ -29,7 +29,7 @@ gboolean gdk_should_use_portal (void);
const char * gdk_get_startup_notification_id (void);
PangoDirection gdk_unichar_direction (gunichar ch);
PangoDirection gdk_unichar_direction (gunichar ch) G_GNUC_CONST;
PangoDirection gdk_find_base_dir (const char *text,
int len);

View File

@ -69,7 +69,7 @@ GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_get_selected_action (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
gboolean gdk_drag_action_is_unique (GdkDragAction action);
gboolean gdk_drag_action_is_unique (GdkDragAction action) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkDrag * gdk_drag_begin (GdkSurface *surface,

View File

@ -67,7 +67,7 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_rgba_parse (GdkRGBA *rgba,
const char *spec);
GDK_AVAILABLE_IN_ALL
char * gdk_rgba_to_string (const GdkRGBA *rgba);
char * gdk_rgba_to_string (const GdkRGBA *rgba) G_GNUC_MALLOC;
G_END_DECLS

View File

@ -39,7 +39,7 @@ typedef enum {
void gsk_cairo_blur_surface (cairo_surface_t *surface,
double radius,
GskBlurFlags flags);
int gsk_cairo_blur_compute_pixels (double radius);
int gsk_cairo_blur_compute_pixels (double radius) G_GNUC_CONST;
cairo_t * gsk_cairo_blur_start_drawing (cairo_t *cr,
float radius,

View File

@ -8,7 +8,7 @@ G_BEGIN_DECLS
void gsk_ensure_resources (void);
int pango_glyph_string_num_glyphs (PangoGlyphString *glyphs);
int pango_glyph_string_num_glyphs (PangoGlyphString *glyphs) G_GNUC_PURE;
typedef struct _GskVulkanRender GskVulkanRender;
typedef struct _GskVulkanRenderPass GskVulkanRenderPass;

View File

@ -24,7 +24,7 @@ void gsk_rounded_rect_scale_affine (GskRoundedRect
float dx,
float dy);
gboolean gsk_rounded_rect_is_circular (const GskRoundedRect *self);
gboolean gsk_rounded_rect_is_circular (const GskRoundedRect *self) G_GNUC_PURE;
void gsk_rounded_rect_path (const GskRoundedRect *self,
cairo_t *cr);
@ -33,7 +33,7 @@ void gsk_rounded_rect_to_float (const GskRounde
gboolean gsk_rounded_rect_equal (gconstpointer rect1,
gconstpointer rect2) G_GNUC_PURE;
char * gsk_rounded_rect_to_string (const GskRoundedRect *self);
char * gsk_rounded_rect_to_string (const GskRoundedRect *self) G_GNUC_MALLOC;
G_END_DECLS

View File

@ -167,7 +167,7 @@ gsk_ngl_uniform_state_get_value (GskNglUniformState *state,
return gsk_ngl_uniform_state_init_value (state, program, format, array_count, key, out_mapping);
}
static inline guint
G_GNUC_PURE static inline guint
gsk_ngl_uniform_state_align (guint current_pos,
guint size)
{

View File

@ -63,13 +63,13 @@ GtkCssParser * gtk_css_parser_new_for_bytes (GBytes
GtkCssParser * gtk_css_parser_ref (GtkCssParser *self);
void gtk_css_parser_unref (GtkCssParser *self);
GFile * gtk_css_parser_get_file (GtkCssParser *self);
GFile * gtk_css_parser_get_file (GtkCssParser *self) G_GNUC_PURE;
GFile * gtk_css_parser_resolve_url (GtkCssParser *self,
const char *url);
const GtkCssLocation * gtk_css_parser_get_start_location (GtkCssParser *self);
const GtkCssLocation * gtk_css_parser_get_end_location (GtkCssParser *self);
const GtkCssLocation * gtk_css_parser_get_block_location (GtkCssParser *self);
const GtkCssLocation * gtk_css_parser_get_start_location (GtkCssParser *self) G_GNUC_PURE;
const GtkCssLocation * gtk_css_parser_get_end_location (GtkCssParser *self) G_GNUC_PURE;
const GtkCssLocation * gtk_css_parser_get_block_location (GtkCssParser *self) G_GNUC_PURE;
const GtkCssToken * gtk_css_parser_peek_token (GtkCssParser *self);
const GtkCssToken * gtk_css_parser_get_token (GtkCssParser *self);
@ -132,9 +132,9 @@ gboolean gtk_css_parser_try_at_keyword (GtkCssParser
gboolean gtk_css_parser_try_token (GtkCssParser *self,
GtkCssTokenType token_type);
char * gtk_css_parser_consume_ident (GtkCssParser *self) G_GNUC_WARN_UNUSED_RESULT;
char * gtk_css_parser_consume_string (GtkCssParser *self) G_GNUC_WARN_UNUSED_RESULT;
char * gtk_css_parser_consume_url (GtkCssParser *self) G_GNUC_WARN_UNUSED_RESULT;
char * gtk_css_parser_consume_ident (GtkCssParser *self) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
char * gtk_css_parser_consume_string (GtkCssParser *self) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
char * gtk_css_parser_consume_url (GtkCssParser *self) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
gboolean gtk_css_parser_consume_number (GtkCssParser *self,
double *number);
gboolean gtk_css_parser_consume_integer (GtkCssParser *self,

View File

@ -129,7 +129,7 @@ GtkCssTokenizer * gtk_css_tokenizer_new (GBytes
GtkCssTokenizer * gtk_css_tokenizer_ref (GtkCssTokenizer *tokenizer);
void gtk_css_tokenizer_unref (GtkCssTokenizer *tokenizer);
const GtkCssLocation * gtk_css_tokenizer_get_location (GtkCssTokenizer *tokenizer);
const GtkCssLocation * gtk_css_tokenizer_get_location (GtkCssTokenizer *tokenizer) G_GNUC_CONST;
gboolean gtk_css_tokenizer_read_token (GtkCssTokenizer *tokenizer,
GtkCssToken *token,

View File

@ -67,7 +67,7 @@ char * gtk_accelerator_get_label_with_keycode (GdkDisplay *display,
guint keycode,
GdkModifierType accelerator_mods);
GDK_AVAILABLE_IN_ALL
GdkModifierType gtk_accelerator_get_default_mod_mask (void);
GdkModifierType gtk_accelerator_get_default_mod_mask (void) G_GNUC_CONST;
G_END_DECLS

View File

@ -250,9 +250,9 @@ const char * _gtk_builder_parser_translate (const char *domain,
const char *context,
const char *text);
char * _gtk_builder_get_resource_path (GtkBuilder *builder,
const char *string);
const char *string) G_GNUC_MALLOC;
char * _gtk_builder_get_absolute_filename (GtkBuilder *builder,
const char *string);
const char *string) G_GNUC_MALLOC;
void _gtk_builder_menu_start (ParserData *parser_data,
const char *element_name,

View File

@ -22,68 +22,6 @@
#include "gtkcssnumbervalueprivate.h"
#include "gtkstylecontextprivate.h"
GtkCssChange
_gtk_css_change_for_sibling (GtkCssChange match)
{
#define BASE_STATES ( GTK_CSS_CHANGE_CLASS \
| GTK_CSS_CHANGE_NAME \
| GTK_CSS_CHANGE_ID \
| GTK_CSS_CHANGE_FIRST_CHILD \
| GTK_CSS_CHANGE_LAST_CHILD \
| GTK_CSS_CHANGE_NTH_CHILD \
| GTK_CSS_CHANGE_NTH_LAST_CHILD \
| GTK_CSS_CHANGE_STATE \
| GTK_CSS_CHANGE_HOVER \
| GTK_CSS_CHANGE_DISABLED \
| GTK_CSS_CHANGE_SELECTED \
| GTK_CSS_CHANGE_BACKDROP)
#define KEEP_STATES ( ~(BASE_STATES|GTK_CSS_CHANGE_SOURCE|GTK_CSS_CHANGE_PARENT_STYLE) \
| GTK_CSS_CHANGE_NTH_CHILD \
| GTK_CSS_CHANGE_NTH_LAST_CHILD)
return (match & KEEP_STATES) | ((match & BASE_STATES) << GTK_CSS_CHANGE_SIBLING_SHIFT);
#undef BASE_STATES
#undef KEEP_STATES
}
GtkCssChange
_gtk_css_change_for_child (GtkCssChange match)
{
#define BASE_STATES ( GTK_CSS_CHANGE_CLASS \
| GTK_CSS_CHANGE_NAME \
| GTK_CSS_CHANGE_ID \
| GTK_CSS_CHANGE_FIRST_CHILD \
| GTK_CSS_CHANGE_LAST_CHILD \
| GTK_CSS_CHANGE_NTH_CHILD \
| GTK_CSS_CHANGE_NTH_LAST_CHILD \
| GTK_CSS_CHANGE_STATE \
| GTK_CSS_CHANGE_HOVER \
| GTK_CSS_CHANGE_DISABLED \
| GTK_CSS_CHANGE_BACKDROP \
| GTK_CSS_CHANGE_SELECTED \
| GTK_CSS_CHANGE_SIBLING_CLASS \
| GTK_CSS_CHANGE_SIBLING_NAME \
| GTK_CSS_CHANGE_SIBLING_ID \
| GTK_CSS_CHANGE_SIBLING_FIRST_CHILD \
| GTK_CSS_CHANGE_SIBLING_LAST_CHILD \
| GTK_CSS_CHANGE_SIBLING_NTH_CHILD \
| GTK_CSS_CHANGE_SIBLING_NTH_LAST_CHILD \
| GTK_CSS_CHANGE_SIBLING_STATE \
| GTK_CSS_CHANGE_SIBLING_HOVER \
| GTK_CSS_CHANGE_SIBLING_DISABLED \
| GTK_CSS_CHANGE_SIBLING_BACKDROP \
| GTK_CSS_CHANGE_SIBLING_SELECTED)
#define KEEP_STATES (~(BASE_STATES|GTK_CSS_CHANGE_SOURCE|GTK_CSS_CHANGE_PARENT_STYLE))
return (match & KEEP_STATES) | ((match & BASE_STATES) << GTK_CSS_CHANGE_PARENT_SHIFT);
#undef BASE_STATES
#undef KEEP_STATES
}
void
gtk_css_change_print (GtkCssChange change,
GString *string)

View File

@ -452,16 +452,75 @@ typedef enum /*< skip >*/ {
GTK_CSS_FONT_VARIANT_EAST_ASIAN_RUBY = 1 << 9
} GtkCssFontVariantEastAsian;
GtkCssChange _gtk_css_change_for_sibling (GtkCssChange match);
GtkCssChange _gtk_css_change_for_child (GtkCssChange match);
static inline GtkCssChange
_gtk_css_change_for_sibling (GtkCssChange match)
{
#define BASE_STATES ( GTK_CSS_CHANGE_CLASS \
| GTK_CSS_CHANGE_NAME \
| GTK_CSS_CHANGE_ID \
| GTK_CSS_CHANGE_FIRST_CHILD \
| GTK_CSS_CHANGE_LAST_CHILD \
| GTK_CSS_CHANGE_NTH_CHILD \
| GTK_CSS_CHANGE_NTH_LAST_CHILD \
| GTK_CSS_CHANGE_STATE \
| GTK_CSS_CHANGE_HOVER \
| GTK_CSS_CHANGE_DISABLED \
| GTK_CSS_CHANGE_SELECTED \
| GTK_CSS_CHANGE_BACKDROP)
GtkCssDimension gtk_css_unit_get_dimension (GtkCssUnit unit);
#define KEEP_STATES ( ~(BASE_STATES|GTK_CSS_CHANGE_SOURCE|GTK_CSS_CHANGE_PARENT_STYLE) \
| GTK_CSS_CHANGE_NTH_CHILD \
| GTK_CSS_CHANGE_NTH_LAST_CHILD)
char * gtk_css_change_to_string (GtkCssChange change);
return (match & KEEP_STATES) | ((match & BASE_STATES) << GTK_CSS_CHANGE_SIBLING_SHIFT);
#undef BASE_STATES
#undef KEEP_STATES
}
static inline GtkCssChange
_gtk_css_change_for_child (GtkCssChange match)
{
#define BASE_STATES ( GTK_CSS_CHANGE_CLASS \
| GTK_CSS_CHANGE_NAME \
| GTK_CSS_CHANGE_ID \
| GTK_CSS_CHANGE_FIRST_CHILD \
| GTK_CSS_CHANGE_LAST_CHILD \
| GTK_CSS_CHANGE_NTH_CHILD \
| GTK_CSS_CHANGE_NTH_LAST_CHILD \
| GTK_CSS_CHANGE_STATE \
| GTK_CSS_CHANGE_HOVER \
| GTK_CSS_CHANGE_DISABLED \
| GTK_CSS_CHANGE_BACKDROP \
| GTK_CSS_CHANGE_SELECTED \
| GTK_CSS_CHANGE_SIBLING_CLASS \
| GTK_CSS_CHANGE_SIBLING_NAME \
| GTK_CSS_CHANGE_SIBLING_ID \
| GTK_CSS_CHANGE_SIBLING_FIRST_CHILD \
| GTK_CSS_CHANGE_SIBLING_LAST_CHILD \
| GTK_CSS_CHANGE_SIBLING_NTH_CHILD \
| GTK_CSS_CHANGE_SIBLING_NTH_LAST_CHILD \
| GTK_CSS_CHANGE_SIBLING_STATE \
| GTK_CSS_CHANGE_SIBLING_HOVER \
| GTK_CSS_CHANGE_SIBLING_DISABLED \
| GTK_CSS_CHANGE_SIBLING_BACKDROP \
| GTK_CSS_CHANGE_SIBLING_SELECTED)
#define KEEP_STATES (~(BASE_STATES|GTK_CSS_CHANGE_SOURCE|GTK_CSS_CHANGE_PARENT_STYLE))
return (match & KEEP_STATES) | ((match & BASE_STATES) << GTK_CSS_CHANGE_PARENT_SHIFT);
#undef BASE_STATES
#undef KEEP_STATES
}
GtkCssDimension gtk_css_unit_get_dimension (GtkCssUnit unit) G_GNUC_CONST;
char * gtk_css_change_to_string (GtkCssChange change) G_GNUC_MALLOC;
void gtk_css_change_print (GtkCssChange change,
GString *string);
const char * gtk_css_pseudoclass_name (GtkStateFlags flags);
const char * gtk_css_pseudoclass_name (GtkStateFlags flags) G_GNUC_CONST;
/* These hash functions are selected so they achieve 2 things:
* 1. collision free among each other

View File

@ -87,7 +87,7 @@ void gtk_editable_set_text (GtkEditable *editable,
GDK_AVAILABLE_IN_ALL
char * gtk_editable_get_chars (GtkEditable *editable,
int start_pos,
int end_pos);
int end_pos) G_GNUC_MALLOC;
GDK_AVAILABLE_IN_ALL
void gtk_editable_insert_text (GtkEditable *editable,
const char *text,

View File

@ -84,7 +84,7 @@ gboolean gtk_init_check_abi_check (int num_checks,
GDK_AVAILABLE_IN_ALL
void gtk_disable_setlocale (void);
GDK_AVAILABLE_IN_ALL
PangoLanguage * gtk_get_default_language (void);
PangoLanguage * gtk_get_default_language (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkTextDirection gtk_get_locale_direction (void);