kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

New compiler warning for vf.c after upgrade to Fedora-28 #518

Closed tavmem closed 5 years ago

tavmem commented 6 years ago

cc -g -pthread -O3 -c -o src/vf.o src/vf.c In file included from src/incs.h:42, from src/vf.c:1: In function ‘formatFn’, inlined from ‘format’ at src/vf.c:101:19: src/vf.c:62:84: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=] if(q<DT_SIZE && q>=DT_SPECIAL_VERB_OFFSET){S u=DT[q].text; n=strlen(u); strncpy(s+r,u,n); r+=n;} ^~~~ src/ts.h:68:24: note: in definition of macro ‘CS’

define CS(n,x) case n:x;break;

                    ^

src/vf.c: In function ‘format’: src/vf.c:62:73: note: length computed here if(q<DT_SIZE && q>=DT_SPECIAL_VERB_OFFSET){S u=DT[q].text; n=strlen(u); strncpy(s+r,u,n); r+=n;} ^~~~~ src/ts.h:68:24: note: in definition of macro ‘CS’

define CS(n,x) case n:x;break;

tavmem commented 6 years ago

Just to complete the documentation:

The function 'formatFn' first appears in commit 7b98eec5098400d9767e52f765ed7304dccaf01e made on Jan 12, 2016. The title for this commit is "Implement $ for (some) functions" However, the code after this commit compiles without the above warning.

The above compiler warning first appears in the 2nd commit e6e55976726fcc3be53d3fc7651e940be74e6777 made on Jan 18, 2016. The title of this commit is "handle additional test cases".

tavmem commented 5 years ago

Currently (9/11/19) get no compiler warnings. Closing this issue.