Debian Patches

Status for a56/1.3+dfsg-12

Patch Description Author Forwarded Bugs Origin Last update
pc-type.patch main.c and gram.c use different declarations of pc as pc is used as an integer everywhere, the 'external unsigned long'
must be wrong (-> #689364)
===================================================================
Thorsten Alteholz <debian@alteholz.de> not-needed
include.patch add some #include's to calm compiler=================================================================== Thorsten Alteholz <debian@alteholz.de> not-needed
Makefile.patch call keybld in local directory, add other targets for tools a56-tobin and bin2h
add hardening stuff to CFLAGS
===================================================================
Thorsten Alteholz <debian@alteholz.de> not-needed
fgets.patch Use fgets() instead of gets() kl0wn <4371017+kl0wn@users.noreply.github.com> not-needed https://github.com/XboxDev/a56/commit/3ef0e0955a19ba42c45444bb2fcc4b6d7ba762c8 2019-10-14
use-standard-function-declarations.patch Use standard function declarations
a56 ues K&R style function definitions, and does not declare many of
the functions that are called from another source file (or from before
their definition). This is generally rather dangerous, and with
recent compiler versions it's a fatal error.

Convert all function definitions to standard C syntax, and:

- For functions that do not return a value, set the return type to
void instead of the previous implicit int.
- For functions that are *printf() wrappers, use varargs instead of
the previous arbitrary-length parameter lists that don't match their
callers.
- Fix sigfpu() to take an int parameter, as required for signal
handlers.

Add/include prototypes as necessary:

- Include gram.h in main.c and update its dependencies in Makefile.
- For functions called from another source file, add a prototype in
a56.h.
- For functions only called from earlier in the same source file,
add a prototype near the top of the file. (These functions should
also be declared static, but that's not a serious issue.)
- Fix sym_def() callers to always pass the final 'f' parameter.
It could alternately be changed to use varargs, but this seemed
like the simpler change.
Ben Hutchings <benh@debian.org> not-needed 2024-07-26
declare-attribute-format.patch Add format attributes to allow type checks on *printf() wrappers
Varargs functions normally can't be type-checked. However gcc can
parse printf()-style format strings and check the following arguments
against them. Declare fatal(), yyerror(), and yywarning() with the
required function attribute.

Adding this will trigger new errors:

main.c:82:25: error: format not a string literal and no format arguments [-Werror=format-security]
82 | fatal(usage);
| ^~~~~
main.c:85:9: error: format not a string literal and no format arguments [-Werror=format-security]
85 | if(input_file == NULL) fatal(usage);
| ^~

To avoid that, change the 'usage' variable to be a const array and
change the format parameters of these functions to be const-qualified.
Ben Hutchings <benh@debian.org> not-needed 2024-07-27
clean-up.patch Clean up code some more... =?UTF-8?q?Rados=C5=82aw=20Kujawa?= <radoslaw.kujawa@c0ff33.net> not-needed https://github.com/rkujawa/a56/commit/2dcf6ca8efabcf31c4c5464b49465ae89ab4dd15 2013-05-16
ansi-c.patch More code cleanup and conversion to ANSI C. =?UTF-8?q?Rados=C5=82aw=20Kujawa?= <radoslaw.kujawa@c0ff33.net> not-needed https://github.com/rkujawa/a56/commit/68dacec16838a482264e67976b23310841bb539c 2013-05-17
fix-type-warnings.patch Fix type warnings
gcc warns:

keybld.c: In function ‘follow’:
keybld.c:119:50: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
119 | arcp->arg = arcup->arg = (void *)n_user_actions;
|
keybld.c:185:47: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
185 | printf("%d", -(int)tp->arg - 1);
|

The trans::arg struct member is declared with type void * but is used
to store both pointers and integers. This is generally unsafe, but it
is OK to store pointers in intptr_t-typed variables. Change
trans::arg to intptr_t and update the casts accordingly.

keybld.c: In function ‘dump_machine’:
keybld.c:171:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
171 | printf("/* %d bytes required for transition table storage */\n",
| ~^
| |
| int
| %ld
172 | sizeof(short) * TRANSITIONS * n_states);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int

Fix this by changing the format string to "%zu".

kparse.c: In function ‘kparse’:
kparse.c:2480:55: warning: array subscript has type ‘char’ [-Wchar-subscripts]
2480 | short transition = transitions[state][*kp];
| ^~~

This warning is implemented because the char type may or may not be
signed. In this case we know char is ASCII alphanumeric so that
doesn't actually make a difference. Add a cast to unsigned char to
avoid the warning.
Ben Hutchings <benh@debian.org> not-needed 2024-07-26
fix-miscellaneous-warnings.patch Fix miscellaneous warnings
gcc warns:

a56.y: In function ‘unary_name’:
a56.y:1922:1: warning: control reaches end of non-void function [-Wreturn-type]
1922 | }
| ^

It's not clear to me whether this function can be called with a value
that's not handled in the switch(), so add a default case to fix this.

a56.y: In function ‘unary_op’:
a56.y:1927:18: warning: variable ‘result’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
1927 | struct n result;
| ^~~~~~

Fix this by declaring it volatile.

a56.y: In function ‘unary_op’:
a56.y:1959:43: warning: operation on ‘result.val.f’ may be undefined [-Wsequence-point]
1959 | else result.val.f = result.val.f = a1.val.f < 0 ? -a1.val.f : a1.val.f;
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There's clearly no need to assign to result.val.f twice here.
Delete the duplicate assignment.

lex.c: In function ‘lgetc’:
lex.c:465:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
465 | c = '\n';
| ~~^~~~~~
lex.c:466:9: note: here
466 | case '\n':
| ^~~~

This fallthrough looks intentional, so declare that.

toomf.c: In function ‘main’:
toomf.c:36:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
36 | int main(int argc, char **argv)
| ~~~~^~~~
toomf.c:36:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
36 | int main(int argc, char **argv)
| ~~~~~~~^~~~

Change the parameter list to void.
Ben Hutchings <benh@debian.org> not-needed 2024-07-26

All known versions for source package 'a56'

Links