Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make check fails to compile playmidi1.c: "error: expected identifier or '(' before numeric constant" #430

Open
746B61 opened this issue Dec 22, 2024 · 0 comments

Comments

@746B61
Copy link

746B61 commented Dec 22, 2024

Getting the latest version from branch master (352cbc5) 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 07cee0b. playmidi1.c first includes midifile.h from the test directory, which has #define note_on 0x90. After commit 07cee0b, ump_msg.h gets included later, which has 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant