fix a few clang warnings.
cover fix a few clang warnings.
All of these should be quite uncontroversial.
I'll propose the second patch for 0.12 after a short while.
v1 -> v2:
redid vnc patch (4/6)
Paolo Bonzini (6):
remove two dead assignments in target-i386/translate.c fix undefined shifts by >32
exec.c: dead assignments
vnc.c: remove dead code
usb-linux.c: remove write-only variable
fix audio_bug related clang false positives
audio/audio.c | 44 ++++++++++++++++++++------------------------ audio/audio_int.h | 3 ++- exec.c | 4 ---- target-i386/translate.c | 2 -- usb-linux.c | 2 -- vl.c | 4 ++-- vnc.c | 3 --- 7 files changed, 24 insertions(+), 38 deletions(-)
PATCH 1/6 remove two dead assignments in target-i386/translate.c
--- target-i386/translate.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
target-i386/translate.c +0 -2
@@ -4692,8 +4692,6 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) ot = dflag +OT_WORD ; modrm =ldub_code (s->pc++); - mod = (modrm >>6 ) &3 ; - rm = (modrm &7 ) |REX_B (s); reg = ((modrm >>3 ) &7 ) | rex_r;gen_ldst_modrm (s, modrm, ot,OR_TMP0 ,0 );
Signature · 1 line
1.6.6
PATCH 2/6 fix undefined shifts by >32
In reply to Paolo Bonzini--- vl.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
vl.c +2 -2
@@ -2373,9 +2373,9 @@ static void numa_add(const char *optarg)fprintf (stderr,"only 63 CPUs in NUMA mode supported.\n" ); } - value = (1 << (endvalue +1 )) - (1 << value); + value = (2ULL << endvalue) - (1ULL << value); }else { - value =1 << value; + value =1ULL << value; } } node_cpumask[nodenr] = value;
Signature · 1 line
1.6.6
PATCH 3/6 exec.c: dead assignments
In reply to Paolo Bonzini--- exec.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
exec.c +0 -4
@@ -2489,17 +2489,13 @@ void *qemu_get_ram_ptr(ram_addr_t addr)ram_addr_t qemu_ram_addr_from_host (void *ptr) {RAMBlock *prev; -RAMBlock **prevp;RAMBlock *block;uint8_t *host = ptr; prev =NULL ; - prevp = &ram_blocks; block = ram_blocks;while (block && (block->host > host || block->host + block->length <= host)) { -if (prev) - prevp = &prev->next; prev = block; block = block->next; }
Signature · 1 line
1.6.6
PATCH 4/6 vnc.c: remove dead code
In reply to Paolo Bonzinito= has always been handled by qemu-sockets.c's inet_listen, not by vnc.c.
--- vnc.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
vnc.c +0 -3
@@ -2535,7 +2535,6 @@ int vnc_display_open(DisplayState *ds, const char *display)const char *options;int password =0 ;int reverse =0 ; -int to_port =0 ;#ifdef CONFIG_VNC_TLS int tls =0 , x509 =0 ;#endif
@@ -2561,8 +2560,6 @@ int vnc_display_open(DisplayState *ds, const char *display) password =1 ;/* Require password auth */ }else if (strncmp (options,"reverse" ,7 ) ==0 ) { reverse =1 ; - }else if (strncmp (options,"to=" ,3 ) ==0 ) { - to_port =atoi (options+3 ) +5900 ; #ifdef CONFIG_VNC_SASL }else if (strncmp (options,"sasl" ,4 ) ==0 ) { sasl =1 ;/* Require SASL auth */
Signature · 1 line
1.6.6
PATCH 5/6 usb-linux.c: remove write-only variable
In reply to Paolo Bonzini--- usb-linux.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
usb-linux.c +0 -2
@@ -1007,11 +1007,9 @@ USBDevice *usb_host_device_open(const char *devname) {struct USBAutoFilter filter;USBDevice *dev; -USBHostDevice *s;char *p; dev =usb_create (NULL /* FIXME */ ,"usb-host" ); - s =DO_UPCAST (USBHostDevice, dev, dev);if (strstr (devname,"auto:" )) {if (parse_filter (devname, &filter) <0 )
Signature · 1 line
1.6.6
PATCH 6/6 fix audio_bug related clang false positives
In reply to Paolo BonziniBy making the abort condition visible in the caller, this fixes several false positives in the audio code.
--- audio/audio.c | 44 ++++++++++++++++++++------------------------ audio/audio_int.h | 3 ++- 2 files changed, 22 insertions(+), 25 deletions(-)
audio/audio.c +20 -24
@@ -118,42 +118,38 @@ struct mixeng_volume nominal_volume = {static void audio_print_options (const char *prefix,struct audio_option *opt); -int audio_bug (const char *funcname,int cond) +void audio_bug_found (const char *funcname) { -if (cond) { -static int shown; - -AUD_log (NULL ,"A bug was just triggered in %s\n" , funcname); -if (!shown) { -struct audio_driver *d; - - shown =1 ; -AUD_log (NULL ,"Save all your work and restart without audio\n" ); -AUD_log (NULL ,"Please send bug report to [email protected]\n" ); -AUD_log (NULL ,"I am sorry\n" ); - d = glob_audio_state.drv; -if (d) { -audio_print_options (d->name, d->options); - } +static int shown; + +AUD_log (NULL ,"A bug was just triggered in %s\n" , funcname); +if (!shown) { +struct audio_driver *d; + + shown =1 ; +AUD_log (NULL ,"Save all your work and restart without audio\n" ); +AUD_log (NULL ,"Please send bug report to [email protected]\n" ); +AUD_log (NULL ,"I am sorry\n" ); + d = glob_audio_state.drv; +if (d) { +audio_print_options (d->name, d->options); } -AUD_log (NULL ,"Context:\n" ); + } +AUD_log (NULL ,"Context:\n" );#if definedAUDIO_BREAKPOINT_ON_BUG # if definedHOST_I386 # if defined __GNUC__ - __asm__ ("int3" ); + __asm__ ("int3" );# elif defined _MSC_VER - _asm _emit 0xcc; + _asm _emit 0xcc;# else -abort (); +abort ();# endif # else -abort (); +abort ();# endif #endif - } - -return cond; }#endif
audio/audio_int.h +2 -1
@@ -223,7 +223,8 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int len);int audio_pcm_hw_clip_out (HWVoiceOut *hw,void *pcm_buf,int live,int pending); -int audio_bug (const char *funcname,int cond); +#define audio_bug (funcname, cond) ((cond) ? audio_bug_found (funcname), 1 : 0) +void audio_bug_found (const char *funcname);void *audio_calloc (const char *funcname,int nmemb,size_t size);void audio_run (const char *msg);
Signature · 1 line
1.6.6