Skip to content

Commit

Permalink
Fix maybe-uninitialized compile warn. (#363)
Browse files Browse the repository at this point in the history
cc1: all warnings being treated as errors
make: *** [/usr/local/cbdb/lib/postgresql/pgxs/src/makefiles/../../src/Makefile.global:1031: src/pg_cron.o] Error 1
make: *** Waiting for unfinished jobs....
In function ‘get_range’,
    inlined from ‘get_list’ at src/entry.c:308:8,
    inlined from ‘parse_cron_entry’ at src/entry.c:195:8:
src/entry.c:413:26: error: ‘num3’ may be used uninitialized [-Werror=maybe-uninitialized]
  412 |         if (num1 < low || num1 > high || num2 < low || num2 > high ||
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  413 |                 num3 < 0 || num3 > high)
      |                 ~~~~~~~~~^~~~~~~~~~~~~~
src/entry.c: In function ‘parse_cron_entry’:
src/entry.c:337:37: note: ‘num3’ was declared here
  337 |         auto int        num1, num2, num3;
      |                                     ^~~~
cc1: all warnings being treated as errors
  • Loading branch information
reshke authored Dec 10, 2024
1 parent f5d1111 commit 7addef9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ get_number(int *numptr, int low, char *names[], int ch, FILE *file)
*/
pc = temp;
len = 0;
/* keep compiler quiet */
*numptr = 0;
all_digits = TRUE;
while (isalnum(ch)) {
if (++len >= MAX_TEMPSTR)
Expand Down

0 comments on commit 7addef9

Please sign in to comment.