Skip to contentSkip to conversation

snd_ctl compiler warnings

DISCUSSION Alan Horstmann 2 participants 5 messages Nov 7, 2008

lore
Share & tools
lore
#0 lore raw

The code I am working with at present includes unremarkable lines such as:

		snd_ctl_elem_value_t *line_in_vol;
		snd_ctl_elem_value_alloca(&line_in_vol);

Building this with a cross compiler for arm based on gcc 4.2.1 gives this warning for the 2nd line:

: warning: the address of 'line_in_vol' will always evaluate as 'true'

but an older compiler on the desktop does not show this. Would this warning be expected in these circumstances, or is the compiler being over zealous? Am I missing something or is there a straightforward way to avoid such warnings? (Code runs OK).

Thanks

Alan

#1 lore raw

At Fri, 7 Nov 2008 08:52:43 +0000,

Quoted 9 lines · Alan Horstmann

The code I am working with at present includes unremarkable lines such as:

		snd_ctl_elem_value_t *line_in_vol;
		snd_ctl_elem_value_alloca(&line_in_vol);

Building this with a cross compiler for arm based on gcc 4.2.1 gives this warning for the 2nd line:

Quoted 6 lines

: warning: the address of 'line_in_vol' will always evaluate as 'true'

but an older compiler on the desktop does not show this. Would this warning be expected in these circumstances, or is the compiler being over zealous? Am I missing something or is there a straightforward way to avoid such warnings? (Code runs OK).

Try the later version of alsa-lib.
This should have been already fixed.

Takashi

#2 lore raw
Quoted 13 lines · you

At Fri, 7 Nov 2008 08:52:43 +0000,

Quoted 11 lines · Alan Horstmann

The code I am working with at present includes unremarkable lines such as:

		snd_ctl_elem_value_t *line_in_vol;
		snd_ctl_elem_value_alloca(&line_in_vol);

Building this with a cross compiler for arm based on gcc 4.2.1 gives this

warning for the 2nd line:
: warning: the address of 'line_in_vol' will always evaluate as 'true'

Quoted 7 lines
Quoted 4 lines

but an older compiler on the desktop does not show this. Would this warning be expected in these circumstances, or is the compiler being over zealous? Am I missing something or is there a straightforward way to avoid such warnings? (Code runs OK).

Try the later version of alsa-lib.
This should have been already fixed.

Thanks very much. You presumably refer to:

http://
git.alsa-project.org/?p=alsa-lib.git;a=commit;h=68e5771a6f7a2aae2dbd02a097719bcd25c6f307

Right now a rebuild of the working environment would be a bit tricky. At the next opportunity I'll see if we can apply that patch to alsa-lib (I think it is 1.0.15 -based) and rebuild. In the meantime the warnings are presumably fairly harmless?

Thanks again,

Alan

#3 lore raw

At Fri, 7 Nov 2008 10:32:22 +0000,

Quoted 25 lines · Alan Horstmann
Quoted 13 lines · you

At Fri, 7 Nov 2008 08:52:43 +0000,

Quoted 11 lines · Alan Horstmann

The code I am working with at present includes unremarkable lines such as:

		snd_ctl_elem_value_t *line_in_vol;
		snd_ctl_elem_value_alloca(&line_in_vol);

Building this with a cross compiler for arm based on gcc 4.2.1 gives this

warning for the 2nd line:
: warning: the address of 'line_in_vol' will always evaluate as 'true'

Quoted 7 lines
Quoted 4 lines

but an older compiler on the desktop does not show this. Would this warning be expected in these circumstances, or is the compiler being over zealous? Am I missing something or is there a straightforward way to avoid such warnings? (Code runs OK).

Try the later version of alsa-lib.
This should have been already fixed.

Thanks very much. You presumably refer to:

Quoted 7 lines

http://
git.alsa-project.org/?p=alsa-lib.git;a=commit;h=68e5771a6f7a2aae2dbd02a097719bcd25c6f307

Right now a rebuild of the working environment would be a bit tricky. At the next opportunity I'll see if we can apply that patch to alsa-lib (I think it is 1.0.15 -based) and rebuild. In the meantime the warnings are presumably fairly harmless?

Yes. It's just a noise and can be safely ignored.

Takashi

#4 lore raw
Quoted 34 lines · you

At Fri, 7 Nov 2008 10:32:22 +0000,

Quoted 31 lines · Alan Horstmann
Quoted 16 lines · you

At Fri, 7 Nov 2008 08:52:43 +0000,

Quoted 13 lines · Alan Horstmann

The code I am working with at present includes unremarkable lines such as:

		snd_ctl_elem_value_t *line_in_vol;
		snd_ctl_elem_value_alloca(&line_in_vol);

Building this with a cross compiler for arm based on gcc 4.2.1 gives this

warning for the 2nd line:
: warning: the address of 'line_in_vol' will always evaluate as : 'true'

Quoted 7 lines
Quoted 4 lines

but an older compiler on the desktop does not show this. Would this warning be expected in these circumstances, or is the compiler being over zealous? Am I missing something or is there a straightforward way to avoid such warnings? (Code runs OK).

Try the later version of alsa-lib.
This should have been already fixed.

Thanks very much. You presumably refer to:

http://
git.alsa-project.org/?p=alsa-lib.git;a=commit;h=68e5771a6f7a2aae2dbd02a09 7719bcd25c6f307

Quoted 6 lines
Quoted 4 lines

Right now a rebuild of the working environment would be a bit tricky. At the next opportunity I'll see if we can apply that patch to alsa-lib (I think it is 1.0.15 -based) and rebuild. In the meantime the warnings are presumably fairly harmless?

Yes. It's just a noise and can be safely ignored.

Sorry if I'm making unnecesssary noise also!

Actually, on reflection I realised that as they are just macros in the header files, and are therefore not part of the embedded alsa-lib (which I cannot change straight away) I hand edited the include/alsa/control.h, adding the helper function locally & substituting the _alloca(..) macros...

...compiler now silent. Much thanks for your assistance.

Alan