From 7e269e6c979e7a10e8f3364b56773dac4cce0b70 Mon Sep 17 00:00:00 2001 From: Bastian de Byl Date: Tue, 12 May 2026 15:40:55 -0400 Subject: [PATCH] fix: drop extern "C" on main to clear -Wpedantic warning src/main.cpp:161:16: warning: cannot declare '::main' with a linkage specification [-Wpedantic] Long-standing upstream OpenInverter code (predates SKUDAK). C++ forbids linkage specifications on main; with -pedantic in CPPFLAGS this fires every build. Confirmed safe to drop: - libopencm3 vector.c:35 forward-declares int main(void) with default linkage and invokes it at boot. - Linker resolves main by symbol name, not by linkage attribute. - stm32-sine has the same upstream issue; same fix applies if we ever push upstream. Bump VERSTR -S3 -> -S4 so the OI web UI version field shows the new build. Verified in the built binary as "4=1.20.R-S4". Build: clean, no compiler warnings (only the long-standing linker RWX notice remains, unrelated). Co-Authored-By: Claude Opus 4.7 (1M context) --- .DS_Store | Bin 0 -> 8196 bytes include/param_prj.h | 4 ++-- src/main.cpp | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..746290dd2bba57796cf4b088ab5fbb1b8f574efd GIT binary patch literal 8196 zcmeHMJ#W-N5S_iVjuQwebO9Rwf{4H$a3Uib3ZxXY;JfH@=!{P!L83tx9R*UTkSI{9 z&>$fSDjEbuI*=%UlApjwLCc%n&3X206VV_dW~JTd+nMou_hfr-eMDqdw};C_i$v5% zXIwaep`me{d#!c+Obj%rr^#q}ZBXRXTBc5@1L}Y}pbn@5>cGF^0M=}7{g!p#MRimM z)Peuf0e(Kj=!}WS(xH8HV6a;NV1#MgaJ;|=z}RErv2=(CnsKE-S8Dtg!?<$H$38Fd zSUPm&Wc=pCcxK~wD8{nm{IN|ZlQ`5-9Z(1A4#b#>Xo*HNrmbNA{%~hc#_}Rfvq_O* zuK(ct{cQYse3&aZPSp}LnY_lK*?N&)bir-=)j9wR;8vrE7Y^Yz8r^=F=bTH6wa`+ zoGwUJy{k`7w&h7}>CX>Oy-$tjlzttSD|PnXeQnaoF5Z?pse3wa&}s9e&TnTvw(0b_ zm6M0%N}Uw#vd%7?%;-j-taIsY6_Hxb-Z}MZ!(H3HPP$Z&hI~v1zD>GCgMg3j-m4;# z@7eR&_2cU#Up*S|(Ju2vw1w+rbMF47rOPrVIp4pW-9NKh$=VbTd0#UxmSVdK19kmp zL$s*_N63M$)4Is}|BLPK|Bui&QmN{II`F3sm?&LKS5bw9ys_~rAERGG=f-)ZLtBC& h_#uGLvp)=R93z!$5|5=r%%JIu0BeH|>cC%h;1`=M6g>a{ literal 0 HcmV?d00001 diff --git a/include/param_prj.h b/include/param_prj.h index c6b113c..15387b5 100644 --- a/include/param_prj.h +++ b/include/param_prj.h @@ -126,9 +126,9 @@ #define CAT_COMM "Communication" // SKUDAK customization suffix: bump on every Skudak-side change so the OpenInverter -// web UI shows a distinct version (e.g. "4=1.20.R-S3") and we can visually confirm +// web UI shows a distinct version (e.g. "4=1.20.R-S4") and we can visually confirm // the right firmware is flashed. Match the stm32-sine -S convention. -#define VERSTR STRINGIFY(4=VER-S3) +#define VERSTR STRINGIFY(4=VER-S4) /***** enums ******/ diff --git a/src/main.cpp b/src/main.cpp index 24ab944..e0214b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -158,7 +158,11 @@ extern "C" void tim2_isr(void) scheduler->Run(); } -extern "C" int main(void) +// C++ forbids a linkage specification on `main` (-Wpedantic). The reset_handler +// in libopencm3's vector.c forward-declares `int main(void)` with default +// linkage and resolves it at link time by symbol name, so dropping `extern "C"` +// here doesn't affect how main is invoked at boot. +int main(void) { extern const TERM_CMD termCmds[];