mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	spa: mark the gettext wrappers with __attribute__((format_arg))
This removes the -Wformat-literal warnings for all _("some message")
calls. Remaining warnings are those where we pass in a custom buffer.
			
			
This commit is contained in:
		
							parent
							
								
									b5ad37c7ac
								
							
						
					
					
						commit
						6a18272fed
					
				
					 3 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -68,6 +68,7 @@ struct spa_i18n_methods {
 | 
				
			||||||
			const char *msgid_plural, unsigned long int n);
 | 
								const char *msgid_plural, unsigned long int n);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SPA_FORMAT_ARG_FUNC(2)
 | 
				
			||||||
static inline const char *
 | 
					static inline const char *
 | 
				
			||||||
spa_i18n_text(struct spa_i18n *i18n, const char *msgid)
 | 
					spa_i18n_text(struct spa_i18n *i18n, const char *msgid)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -195,6 +195,7 @@ struct spa_fraction {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __GNUC__
 | 
					#ifdef __GNUC__
 | 
				
			||||||
#define SPA_PRINTF_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
 | 
					#define SPA_PRINTF_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
 | 
				
			||||||
 | 
					#define SPA_FORMAT_ARG_FUNC(arg1) __attribute__((format_arg(arg1)))
 | 
				
			||||||
#define SPA_ALIGNED(align) __attribute__((aligned(align)))
 | 
					#define SPA_ALIGNED(align) __attribute__((aligned(align)))
 | 
				
			||||||
#define SPA_DEPRECATED __attribute__ ((deprecated))
 | 
					#define SPA_DEPRECATED __attribute__ ((deprecated))
 | 
				
			||||||
#define SPA_EXPORT __attribute__((visibility("default")))
 | 
					#define SPA_EXPORT __attribute__((visibility("default")))
 | 
				
			||||||
| 
						 | 
					@ -203,6 +204,7 @@ struct spa_fraction {
 | 
				
			||||||
#define SPA_NORETURN __attribute__ ((noreturn))
 | 
					#define SPA_NORETURN __attribute__ ((noreturn))
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define SPA_PRINTF_FUNC(fmt, arg1)
 | 
					#define SPA_PRINTF_FUNC(fmt, arg1)
 | 
				
			||||||
 | 
					#define SPA_FORMAT_ARG_FUNC(arg1)
 | 
				
			||||||
#define SPA_ALIGNED(align)
 | 
					#define SPA_ALIGNED(align)
 | 
				
			||||||
#define SPA_DEPRECATED
 | 
					#define SPA_DEPRECATED
 | 
				
			||||||
#define SPA_EXPORT
 | 
					#define SPA_EXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,8 +31,8 @@ extern "C" {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <spa/support/i18n.h>
 | 
					#include <spa/support/i18n.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *pw_gettext(const char *msgid);
 | 
					SPA_FORMAT_ARG_FUNC(1) const char *pw_gettext(const char *msgid);
 | 
				
			||||||
const char *pw_ngettext(const char *msgid, const char *msgid_plural, unsigned long int n);
 | 
					SPA_FORMAT_ARG_FUNC(1) const char *pw_ngettext(const char *msgid, const char *msgid_plural, unsigned long int n);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define _(String)	(pw_gettext(String))
 | 
					#define _(String)	(pw_gettext(String))
 | 
				
			||||||
#define N_(String)	(String)
 | 
					#define N_(String)	(String)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue