smartnode / telebot

Telegram Bot API in C
https://elmurod.net/telebot
Apache License 2.0
162 stars 38 forks source link

Fails to build under gcc 9.2.0 #25

Closed alajpie closed 4 years ago

alajpie commented 5 years ago
[ 16%] Building C object CMakeFiles/telebot.dir/src/telebot-parser.c.o
[ 33%] Building C object CMakeFiles/telebot.dir/src/telebot-core.c.o
[ 50%] Building C object CMakeFiles/telebot.dir/src/telebot.c.o
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c: In function ‘telebot_get_updates’:
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:159:26: error: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
  159 |                 snprintf(allowed_updates_str, 1024, "%s%s,", allowed_updates_str,
      |                          ^~~~~~~~~~~~~~~~~~~                 ~~~~~~~~~~~~~~~~~~~
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:162:26: error: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
  162 |                 snprintf(allowed_updates_str, 1024, "%s%s", allowed_updates_str,
      |                          ^~~~~~~~~~~~~~~~~~~                ~~~~~~~~~~~~~~~~~~~
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:165:18: error: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
  165 |         snprintf(allowed_updates_str, 1024, "%s%s", allowed_updates_str,"]");
      |                  ^~~~~~~~~~~~~~~~~~~                ~~~~~~~~~~~~~~~~~~~
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c: In function ‘telebot_set_webhook’:
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:329:26: error: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
  329 |                 snprintf(allowed_updates_str, 1024, "%s%s,", allowed_updates_str,
      |                          ^~~~~~~~~~~~~~~~~~~                 ~~~~~~~~~~~~~~~~~~~
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:332:26: error: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
  332 |                 snprintf(allowed_updates_str, 1024, "%s%s", allowed_updates_str,
      |                          ^~~~~~~~~~~~~~~~~~~                ~~~~~~~~~~~~~~~~~~~
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:335:18: error: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
  335 |         snprintf(allowed_updates_str, 1024, "%s%s", allowed_updates_str, "]");
      |                  ^~~~~~~~~~~~~~~~~~~                ~~~~~~~~~~~~~~~~~~~
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c: In function ‘telebot_get_updates’:
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:165:50: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  165 |         snprintf(allowed_updates_str, 1024, "%s%s", allowed_updates_str,"]");
      |                                                  ^
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:165:9: note: ‘snprintf’ output between 2 and 1025 bytes into a destination of size 1024
  165 |         snprintf(allowed_updates_str, 1024, "%s%s", allowed_updates_str,"]");
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:159:59: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  159 |                 snprintf(allowed_updates_str, 1024, "%s%s,", allowed_updates_str,
      |                                                           ^
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:159:17: note: ‘snprintf’ output 2 or more bytes (assuming 1025) into a destination of size 1024
  159 |                 snprintf(allowed_updates_str, 1024, "%s%s,", allowed_updates_str,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  160 |                         telebot_update_type_str[allowed_updates[i]]);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c: In function ‘telebot_set_webhook’:
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:335:50: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  335 |         snprintf(allowed_updates_str, 1024, "%s%s", allowed_updates_str, "]");
      |                                                  ^
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:335:9: note: ‘snprintf’ output between 2 and 1025 bytes into a destination of size 1024
  335 |         snprintf(allowed_updates_str, 1024, "%s%s", allowed_updates_str, "]");
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:329:59: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  329 |                 snprintf(allowed_updates_str, 1024, "%s%s,", allowed_updates_str,
      |                                                           ^
/home/alice/at/2019-10-18_19:03:05/telebot/src/telebot.c:329:17: note: ‘snprintf’ output 2 or more bytes (assuming 1025) into a destination of size 1024
  329 |                 snprintf(allowed_updates_str, 1024, "%s%s,", allowed_updates_str,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  330 |                         telebot_update_type_str[allowed_updates[i]]);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/telebot.dir/build.make:89: CMakeFiles/telebot.dir/src/telebot.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:77: CMakeFiles/telebot.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
smartnode commented 5 years ago

This patch should fix it. Try and let me know, I don't have gcc 9.2 at hand.