From dfb934ab1f7ace9d7227a26847cfde9a502b43c6 Mon Sep 17 00:00:00 2001 From: Abdalla Al-Dalleh Date: Thu, 4 Jun 2026 15:48:39 +0300 Subject: [PATCH] Fixed gcc -Wstringop-overflow and -Wdeprecated-declarations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1st warning: ../seq_mac.c: In function ‘seqMacEval’: ../seq_mac.c:81:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=] strncpy(outStr, value, valLth); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../seq_mac.c:75:14: note: length computed here valLth = strlen(value); seqMacEval already passes the destination size as the 4th argument maxChar, this is clear in various calls: - src/seq/seq_main.c:395 - src/seq/seq_if.c:668 2nd warning: ../../../include/seqMain.c: In function ‘main’: ../../../include/seqMain.c:28:9: warning: ‘epicsThreadExitMain’ is deprecated [-Wdeprecated-declarations] epicsThreadExitMain(); function call has been replaced with a loop+sleep, as the deprecation notice suggest. Similar call exist in test/validate/seqMain.c --- src/seq/seq_mac.c | 2 +- src/snc/seqMain.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/seq/seq_mac.c b/src/seq/seq_mac.c index 2c2500ef..4b07090b 100644 --- a/src/seq/seq_mac.c +++ b/src/seq/seq_mac.c @@ -78,7 +78,7 @@ void seqMacEval(PROG *sp, const char *inStr, char *outStr, size_t maxChar) DEBUG("Value=%s, ", value); - strncpy(outStr, value, valLth); + strncpy(outStr, value, maxChar); maxChar -= valLth; outStr += valLth; } diff --git a/src/snc/seqMain.c b/src/snc/seqMain.c index a4d8e326..fbf27ec0 100644 --- a/src/snc/seqMain.c +++ b/src/snc/seqMain.c @@ -25,7 +25,8 @@ int main(int argc,char *argv[]) { seqRegisterSequencerCommands(); iocsh(0); } else { - epicsThreadExitMain(); + // epicsThreadExitMain(); + while (1) epicsThreadSleep(1); } return(0); }