mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	object: Get rid of "warning: cast increases required alignment of target type"
On ARM, pa_object has less strict alignment requirements
than e.g. pa_sink and pa_source, so when pa_object is cast
to pa_sink, the compiler thinks that it's unsafe. In this
case, however, the pointer given to pa_sink_ref() was a
pa_sink pointer to begin with, so casting it first to
pa_object and then back to pa_sink is entirely safe.
This particular source of warnings is extremely annoying,
because this message is printed for any compilation unit
that includes sink.h, source.h or any other header that
defines a class, and the message tends to get printed
multiple times for one compilation unit:
In file included from ./pulsecore/source-output.h:37:0,
                 from ./pulsecore/source.h:49,
                 from ./pulsecore/sink.h:40,
                 from ./pulsecore/core.h:50,
                 from daemon/daemon-conf.h:31,
                 from daemon/cmdline.h:25,
                 from daemon/cmdline.c:38:
./pulsecore/sink-input.h: In function 'pa_sink_input_ref':
./pulsecore/sink-input.h:245:1: warning: cast increases required alignment of target type [-Wcast-align]
			
			
This commit is contained in:
		
							parent
							
								
									3d6092bb0f
								
							
						
					
					
						commit
						0359f6c624
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -79,7 +79,7 @@ static inline pa_object* pa_object_cast(void *o) {
 | 
			
		|||
        return (c*) o;                                                  \
 | 
			
		||||
    }                                                                   \
 | 
			
		||||
    static inline c* c##_ref(c *o) {                                    \
 | 
			
		||||
        return (c*) pa_object_ref(PA_OBJECT(o));                        \
 | 
			
		||||
        return (c *) ((void *) pa_object_ref(PA_OBJECT(o)));            \
 | 
			
		||||
    }                                                                   \
 | 
			
		||||
    static inline void c##_unref(c* o) {                                \
 | 
			
		||||
        pa_object_unref(PA_OBJECT(o));                                  \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue