jgabaut/helapordo

[BUG] Some animations are deformed when building with --std=c11

Closed this issue · 2 comments

Describe the bug

With version 1.2.9, a --std=c11 flag was added to Makefile.am. However, the unintentional trigraphs in ./src/animations/* files are being replaced with a different literal, and the visuals get corrupted.

I think this would need some update on sprites4curses (see related issue) to not cause this issue anymore, or a downstream patch involving some escaping/breaking up of the offending sequences with sed or something.

To Reproduce

  1. Build 1.2.9 (Tag includes the --std=c11 flag)
  2. Run and check out examples like Mage or Imp animations.

Expected behavior
Correct display of the animations.

Screenshots
screen

Desktop (please complete the following information):

  • OS: Linux x86_64
  • Version 1.2.9

Additional context

https://stackoverflow.com/questions/9387166/is-there-a-switch-to-disable-trigraphs-with-clang

Wikipedia:

[...] A programmer may want to place two question marks together yet not have the compiler treat them as introducing a trigraph. The C grammar does not permit two consecutive ? tokens, so the only places in a C file where two question marks in a row may be used are in multi-character constants, string literals, and comments. This is particularly a problem for the classic Mac OS, where the constant '????' may be used as a file type or creator. To safely place two consecutive question marks within a string literal, the programmer can use string concatenation "...?""?..." or an escape sequence "...??...".

1.2.10 dropped --std=c11 to avoid the issue, somewhat.

sprites4curses closed the related issue with 0.3.5 (See s4c issue).

I'll try to fix up the animation files ASAP and use the new release.

1.3.0 updates s4c to 0.3.5 and fixes the offending animation files, so it can correcty build with --std=c11.
Also, -Wno-trigraphs was removed as we now don't expect to get that warning.