make check fails to compile playmidi1.c: "error: expected identifier or '(' before numeric constant"
alsa-project/alsa-lib issue #430 was opened from 746B61:
Getting the latest version from branch master (352cbc5e) and running ./gitcompile followed by make check fails with:
```
Making check in test
make[1]: Entering directory '/tmp/alsa-lib-master/test'
Making check in .
make[2]: Entering directory '/tmp/alsa-lib-master/test'
make control pcm pcm_min latency seq seq-ump-example playmidi1 timer rawmidi midiloop umpinfo oldapi queue_timer namehint client_event_filter chmap audio_time user-ctl-element-set pcm-multi-thread
make[3]: Entering directory '/tmp/alsa-lib-master/test'
CC control.o
CCLD control
CC pcm.o
CCLD pcm
CC pcm_min.o
CCLD pcm_min
CC latency.o
CCLD latency
CC seq.o
In file included from seq.c:12:
seq-sender.c: In function 'event_sender':
seq-sender.c:150:62: warning: variable 'pcm_flag' set but not used [-Wunused-but-set-variable]
150 | int client, port, queue, max, err, v1, v2, time = 0, pcm_flag = 0;
| ^~~~~~~~
CCLD seq
CC seq-ump-example.o
CCLD seq-ump-example
CC playmidi1.o
In file included from playmidi1.c:48:
midifile.h:55:33: error: expected identifier or '(' before numeric constant
55 | #define note_on 0x90
| ^~~~
../include/alsa/ump_msg.h:170:41: note: in expansion of macro 'note_on'
170 | snd_ump_msg_midi1_note_t note_on; /**< MIDI1 note-on message */
| ^~~~~~~
midifile.h:54:33: error: expected identifier or '(' before numeric constant
54 | #define note_off 0x80
| ^~~~
../include/alsa/ump_msg.h:171:41: note: in expansion of macro 'note_off'
171 | snd_ump_msg_midi1_note_t note_off; /**< MIDI1 note-off message */
| ^~~~~~~~
midifile.h:57:33: error: expected identifier or '(' before numeric constant
57 | #define control_change 0xb0
| ^~~~
../include/alsa/ump_msg.h:173:41: note: in expansion of macro 'control_change'
173 | snd_ump_msg_midi1_cc_t control_change; /**< MIDI1 control-change message */
| ^~~~~~~~~~~~~~
midifile.h:55:33: error: expected identifier or '(' before numeric constant
55 | #define note_on 0x90
| ^~~~
../include/alsa/ump_msg.h:432:41: note: in expansion of macro 'note_on'
432 | snd_ump_msg_midi2_note_t note_on; /**< MIDI2 note-on message */
| ^~~~~~~
midifile.h:54:33: error: expected identifier or '(' before numeric constant
54 | #define note_off 0x80
| ^~~~
../include/alsa/ump_msg.h:433:41: note: in expansion of macro 'note_off'
433 | snd_ump_msg_midi2_note_t note_off; /**< MIDI2 note-off message */
| ^~~~~~~~
midifile.h:57:33: error: expected identifier or '(' before numeric constant
57 | #define control_change 0xb0
| ^~~~
../include/alsa/ump_msg.h:438:41: note: in expansion of macro 'control_change'
438 | snd_ump_msg_midi2_cc_t control_change; /**< MIDI2 control-change message */
| ^~~~~~~~~~~~~~
In file included from playmidi1.c:49:
midifile.c:57:33: error: expected identifier or '(' before numeric constant
57 | #define set_tempo 0x51
| ^~~~
../include/alsa/ump_msg.h:711:41: note: in expansion of macro 'set_tempo'
711 | snd_ump_msg_set_tempo_t set_tempo; /**< Set Tempo */
| ^~~~~~~~~
make[3]: *** [Makefile:622: playmidi1.o] Error 1
make[3]: Leaving directory '/tmp/alsa-lib-master/test'
make[2]: *** [Makefile:819: check-am] Error 2
make[2]: Leaving directory '/tmp/alsa-lib-master/test'
make[1]: *** [Makefile:669: check-recursive] Error 1
make[1]: Leaving directory '/tmp/alsa-lib-master/test'
make: *** [Makefile:414: check-recursive] Error 1
```The issue was introduced with commit 07cee0ba. playmidi1.c first [includes](https://github.com/alsa-project/alsa-lib/blob/352cbc5eb94a271a9c3c0ff5bf1742232a69e0d0/test/playmidi1.c#L48) midifile.h from the test directory, which [has](https://github.com/alsa-project/alsa-lib/blob/352cbc5eb94a271a9c3c0ff5bf1742232a69e0d0/test/midifile.h#L55) #define note_on 0x90. After commit 07cee0ba, ump_msg.h gets included later, which [has](https://github.com/alsa-project/alsa-lib/blob/352cbc5eb94a271a9c3c0ff5bf1742232a69e0d0/include/ump_msg.h#L170C27-L170C34) snd_ump_msg_midi1_note_t note_on; /**< MIDI1 note-on message */. The preprocessor replaces note_on with 0x90 and the compilation fails with the error above.
Issue URL : https://github.com/alsa-project/alsa-lib/issues/430
Repository URL: https://github.com/alsa-project/alsa-lib