mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 01:58:54 +01:00 
			
		
		
		
	girparser: Use INTEGER_ALIAS to reduce repetition
As a special case, keep the historical behaviour of treating gchar as being signed, both on platforms where it is genuinely signed (for example x86 Linux) and where it is unsigned (for example ARM, s390x and PowerPC Linux). Changing gchar to use INTEGER_ALIAS would have a regression risk, so if we want to do that, it should be as a separate change. No functional change intended. Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
		
				
					committed by
					
						
						Philip Withnall
					
				
			
			
				
	
			
			
			
						parent
						
							d02f5816bf
						
					
				
				
					commit
					7c41a6529b
				
			@@ -462,19 +462,23 @@ G_STATIC_ASSERT (signedness (int) == 1);
 | 
			
		||||
G_STATIC_ASSERT (signedness (unsigned int) == 0);
 | 
			
		||||
 | 
			
		||||
static IntegerAliasInfo integer_aliases[] = {
 | 
			
		||||
  { "gchar",    sizeof (gchar),   1 },
 | 
			
		||||
  { "guchar",   sizeof (guchar),  0 },
 | 
			
		||||
  { "gshort",   sizeof (gshort),  1 },
 | 
			
		||||
  { "gushort",  sizeof (gushort), 0 },
 | 
			
		||||
  { "gint",     sizeof (gint),    1 },
 | 
			
		||||
  { "guint",    sizeof (guint),   0 },
 | 
			
		||||
  { "glong",    sizeof (glong),   1 },
 | 
			
		||||
  { "gulong",   sizeof (gulong),  0 },
 | 
			
		||||
  { "gssize",   sizeof (gssize),  1 },
 | 
			
		||||
  { "gsize",    sizeof (gsize),   0 },
 | 
			
		||||
  { "gintptr",  sizeof (gintptr),      1 },
 | 
			
		||||
  { "guintptr", sizeof (guintptr),     0 },
 | 
			
		||||
  /* It is platform-dependent whether gchar is signed or unsigned, but
 | 
			
		||||
   * GObject-Introspection has traditionally treated it as signed,
 | 
			
		||||
   * so continue to hard-code that instead of using INTEGER_ALIAS */
 | 
			
		||||
  { "gchar", sizeof (gchar), 1 },
 | 
			
		||||
 | 
			
		||||
#define INTEGER_ALIAS(T) { #T, sizeof (T), signedness (T) }
 | 
			
		||||
  INTEGER_ALIAS (guchar),
 | 
			
		||||
  INTEGER_ALIAS (gshort),
 | 
			
		||||
  INTEGER_ALIAS (gushort),
 | 
			
		||||
  INTEGER_ALIAS (gint),
 | 
			
		||||
  INTEGER_ALIAS (guint),
 | 
			
		||||
  INTEGER_ALIAS (glong),
 | 
			
		||||
  INTEGER_ALIAS (gulong),
 | 
			
		||||
  INTEGER_ALIAS (gssize),
 | 
			
		||||
  INTEGER_ALIAS (gsize),
 | 
			
		||||
  INTEGER_ALIAS (gintptr),
 | 
			
		||||
  INTEGER_ALIAS (guintptr),
 | 
			
		||||
  INTEGER_ALIAS (off_t),
 | 
			
		||||
  INTEGER_ALIAS (time_t),
 | 
			
		||||
#ifdef G_OS_UNIX
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user