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

Ошибка при сборке #75

Open
IvanKayukoff opened this issue Jan 22, 2020 · 3 comments
Open

Ошибка при сборке #75

IvanKayukoff opened this issue Jan 22, 2020 · 3 comments
Assignees
Labels

Comments

@IvanKayukoff
Copy link

$  uname -a
Linux dick 5.4.12-arch1-1 #1 SMP PREEMPT Tue, 14 Jan 2020 21:44:31 +0000 x86_64 GNU/Linux
$ gcc --version
gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Лог make:

$ make   
gcc --std=gnu99 -pedantic -Wall -Wextra -Werror -ggdb3 -Ilib -D_DEBUG -lncursesw -pthread -I /usr/include/ncursesw  -Wimplicit-fallthrough=0 -DPROTOCOL_VERSION=`perl -lne '$a+=$_+$. for split//;END{print$a}' src/*` -c src/config.c -o bin/config.o
In file included from src/config.c:4:
src/config.c: In function ‘config_init’:
src/config.c:248:19: error: ‘%s’ directive output may be truncated writing up to 8191 bytes into a region of size 8177 [-Werror=format-truncation=]
  248 |             warnf("[info] Config: %s: not found.", buf);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
src/itmmorgue.h:68:34: note: in definition of macro ‘warnf’
   68 |         snprintf(___buf, BUFSIZ, fmt, __VA_ARGS__); \
      |                                  ^~~
src/config.c:248:35: note: format string is defined here
  248 |             warnf("[info] Config: %s: not found.", buf);
      |                                   ^~
In file included from src/config.c:4:
src/itmmorgue.h:68:9: note: ‘snprintf’ output between 28 and 8219 bytes into a destination of size 8192
   68 |         snprintf(___buf, BUFSIZ, fmt, __VA_ARGS__); \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/config.c:248:13: note: in expansion of macro ‘warnf’
  248 |             warnf("[info] Config: %s: not found.", buf);
      |             ^~~~~
src/config.c:256:19: error: ‘%s’ directive output may be truncated writing up to 8191 bytes into a region of size 8177 [-Werror=format-truncation=]
  256 |             warnf("[info] Config: %s: not found.", buf);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
src/itmmorgue.h:68:34: note: in definition of macro ‘warnf’
   68 |         snprintf(___buf, BUFSIZ, fmt, __VA_ARGS__); \
      |                                  ^~~
src/config.c:256:35: note: format string is defined here
  256 |             warnf("[info] Config: %s: not found.", buf);
      |                                   ^~
In file included from src/config.c:4:
src/itmmorgue.h:68:9: note: ‘snprintf’ output between 28 and 8219 bytes into a destination of size 8192
   68 |         snprintf(___buf, BUFSIZ, fmt, __VA_ARGS__); \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/config.c:256:13: note: in expansion of macro ‘warnf’
  256 |             warnf("[info] Config: %s: not found.", buf);
      |             ^~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:40: bin/config.o] Error 1

found by kk

@ValeriyKr ValeriyKr self-assigned this Jan 22, 2020
@ValeriyKr ValeriyKr added the bug label Jan 22, 2020
@ValeriyKr
Copy link
Collaborator

Ветка master, воспроизведено на debian, gcc 8.3.0.

@zhmylove
Copy link
Owner

@ValeriyKr считаю, достаточно отключить format-truncation warning, т.к. мы намеренно используем snprintf. Согласен?

@ValeriyKr
Copy link
Collaborator

@zhmylove блин, я вчитался в код. Это из разряда implicit fallthrough, только ещё бредовее. Предупреждение о том, что функция, используемая по своему назначению может сработать так, как описывается в документации. Согласен, бредовый варнинг.

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

No branches or pull requests

3 participants