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

Minor warning #110

Open
polluks opened this issue Oct 2, 2022 · 5 comments
Open

Minor warning #110

polluks opened this issue Oct 2, 2022 · 5 comments

Comments

@polluks
Copy link

polluks commented Oct 2, 2022

ppc-morphos-gcc-11 -g -O2 -Wall -pipe  -I.  -c -o subs.o subs.c
subs.c: In function 'user_ps_add':
subs.c:1845:38: warning: 'svg ' directive writing 4 bytes into a region of size 1 [-Wformat-overflow=]
 1845 |                 sprintf(t->text, "%%svg %s", s);
      |                                     ~^~~
subs.c:1845:17: note: 'sprintf' output 6 or more bytes into a destination of
size 2
 1845 |                 sprintf(t->text, "%%svg %s", s);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@moinejf
Copy link
Collaborator

moinejf commented Oct 2, 2022

I don't know how to remove this warning that is not raised by my compiler (gcc version 10.2.1 20201203).
Maybe an array with an undefined length could solve this problem, but I know many C compilers would not agree!

@polluks
Copy link
Author

polluks commented Oct 2, 2022

My compiler:
ppc-morphos-gcc-11 (GCC/MorphOS) 11.2.0
Copyright (C) 2021 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.

By the way:
http://aminet.net/package/mus/misc/abcm2ps

@mid1221213
Copy link

I don't know how to remove this warning that is not raised by my compiler (gcc version 10.2.1 20201203). Maybe an array with an undefined length could solve this problem, but I know many C compilers would not agree!

Maybe just a matter of a #if __GNUC__ > 10 before the declaration of the array with undefined length (#else what is already present)? But that would also require a macro to define SIZEOF_U_PS_TEXT or something...

That may sound too much for "just a warning", especially when I get the warnings about Pango too (#111) 😉

Anyway, I can provide with a PR if that may be useful, I have the code ready for review (I wanted to check this issue, go figure… 😉)

@moinejf
Copy link
Collaborator

moinejf commented Oct 10, 2022

I think the commit 92163a7 should solve the problem.

@mid1221213
Copy link

Okay 😆
Fine for me.

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

3 participants