Commit 6d9b069d2336ad94f5a02f9d98d510971288af6f
1 parent
11459f28
unit-test-client: fix compilation on compilers not supporting c99 mode
This fixes the message "error: 'for' loop initial declarations are only allowed in C99 mode", spotted during cross-compiling of libmodbus. The compiler (gcc) actually does support -std=c99 but it gets not enabled by default. So a solution would be to enforce c99 mode via CFLAGS, but this will knock out all compilers which do not support this mode. Moving the declaration out of the loop initialisation, seems to be the simpler solution. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Showing
1 changed file
with
2 additions
and
1 deletions
tests/unit-test-client.c
| ... | ... | @@ -744,8 +744,9 @@ int send_crafted_request(modbus_t *ctx, int function, |
| 744 | 744 | { |
| 745 | 745 | const int EXCEPTION_RC = 2; |
| 746 | 746 | uint8_t rsp[MODBUS_TCP_MAX_ADU_LENGTH]; |
| 747 | + int j; | |
| 747 | 748 | |
| 748 | - for (int j=0; j<2; j++) { | |
| 749 | + for (j=0; j<2; j++) { | |
| 749 | 750 | int rc; |
| 750 | 751 | |
| 751 | 752 | req[1] = function; | ... | ... |