Conversation
+ Use set_terminate instead, which is not a direct replacement as it handles a few more cases but the end result is identical from a user's perspective. As a bonus, now regular exceptions print out nicely.
+ Makes the intentions a bit more clear and silences some warnings with gcc >= 14
+ The boolean is only used for overload resolution, so it doesn't need a name
+ C23 removes the old style completely, meaning this change would've been done in a couple years anyway (C23 is default starting with gcc >= 16, IIUC)
| @@ -43,9 +43,7 @@ DESCRIPTION | |||
| */ | |||
|
|
|||
| int | |||
There was a problem hiding this comment.
Did you check if newer newlibs have updated the files to newer C standards? Otherwise we better avoid unnecessary changes as it makes diffing against upstream newlib more difficult.
There was a problem hiding this comment.
Seem to still be using the old style: https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/reent/closer.c;h=2d72b2ab59e3332e44ee0c40acfa8da0abfbed7b;hb=HEAD
Compiling upstream newlib doesn't produce warnings because they just don't enable warnings :p Tried checking if anyone had sent patches upstream to see if there maybe was a reason the files hadn't been changed but didn't find any references to C23 or the specific warning message:
a function definition without a prototype is deprecated in all versions of C and is not supported in C2x
There was a problem hiding this comment.
Fixed it upstream: https://sourceware.org/pipermail/newlib/2026/022304.html
There was a problem hiding this comment.
Good. I think it's better for us also to silence those warnings for newlib than to patch a lot our downstream copy, and then when it's fixed upstream we can synch from there.
| bool finalized_; | ||
| /// LineReader for interpreter. | ||
| LineReader* reader_; | ||
| virtual void initialize(int argc, char* argv[], |
There was a problem hiding this comment.
Odd, for whatever reason format-branch.sh didn't see anything wrong here. I ran the whole file through the formatter which returned the file back to normal. Unsure what the deal here was.
|
|
||
|
|
||
| void inline addAssignment( | ||
| const SimValue& assignValue, SimValue* assignTarget, int latency); |
There was a problem hiding this comment.
The above is the original TCE style guide indentation. If this cannot be fixed easily in clang format, let it be.
There was a problem hiding this comment.
To clarify: Do you mean that the original style was to place all parameters on their own line if they didn't fit on a single line? That's easily configured, but the .clang-format file has seemingly always been set to produce code like the above and a fair bit of the codebase seems to follow the autoformatting style.
The relevant parameters in this case:
https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowallparametersofdeclarationonnextline
https://clang.llvm.org/docs/ClangFormatStyleOptions.html#binpackparameters
There was a problem hiding this comment.
Yes, I remember the indenting was different in .hh than the .cc, but do whatever seems the most uniform style here.
| #ifdef Avoid_Underflow | ||
| if (scale && y <= 2*P*Exp_msk1) { | ||
| if (aadj <= 0x7fffffff) { | ||
| if (aadj <= 0x80000000) { |
There was a problem hiding this comment.
GCC emits
warning: implicit conversion from 'int' to 'double' changes value from 2147483647 to 2147483648
so 0x80000000 at least matches the comparison that takes place, if not what is intended to happen.
There was a problem hiding this comment.
OK, perhaps check if the newer Newlibs have this fixed?
There was a problem hiding this comment.
Slight correction: Warning comes from tcecc, where double is (in this case at least) apparently 32 bits in size. Couldn't get the warning to show up when compiling on my home computer. 32 bit doubles I goes against the C standard, so I guess the proper fix would be to implement 64 bit doubles in the compiler :)
newlib does have a macro _DOUBLE_IS_32BITS which is used, so I guess a workaround might be do to something like
#ifdef _DOUBLE_IS_32BITS
// use 0x8000000
#else
// use 0x7ffffffff
#endif
I don't think there's a proper testsuite for newlib on tce, so would have to test it with some other architecture that has one and defines _DOUBLE_IS_32BITS, maybe avr or something, to check if the implicit conversion is unintended and as such a bug, or intended and just happens to trigger a warning.
Joonari
left a comment
There was a problem hiding this comment.
Only a couple of minor comments from me.
It's not directly related to this PR, but it popped up again here, that the coprocessor generator tool doesn't have a proper systemtest that would run RTL simulations. Currently it only checks that the generated RTL can be compiled. The manual has instructions on how to do that manually, but it requires the user to install CVA6 + rocket chip toolchains. It would be good to do that in the CI, but maybe not require those when running systemtests locally?
+ Was a bit too excited and removed one line too many.
+ For whatever reason, when only given the git patch the formatter indented one step too far
Currently, with at least gcc >= 14, a couple thousand lines of trivally fixable warnings are emitted when doing a full rebuild. This PR fixes the majority of them, and the full stderr log for a clean build now looks like the following (on my machine, at least):
The
arwarnings are fixable by something likebut that modifies generated
Makefile.infiles innewlib, which I'm not entirely sure about. Same goes forMakefile:1404.Other than that, the archaic function definition style used in parts of
newlibbecomes a hard error in gcc >= 15 when the default C version is upped to C23 IIUC, so while this PR does a fair bit of modifications tonewlib, they would likely have to be done sooner or later anyway.The remaining warnings are kind of annoying in that the unused parameters are unused in the public OpenASIP, but are used in the internal branch, so commenting them out here would likely lead to compilation failures when merged.
This PR looks big, but most of the linecount comes from just 3d5f5a7, where a fairly widely used deprecated method of making objects noncopyable is replaced by marking constructors/assignments
= deleted. This clarifies semantics and helps the compiler produce more informative error messages if an object is used incorrectly. With C++26, we could also attach an explanation to= deletedto explain why the object is noncopyable, but that's probably pretty far in the future.Silencing warnings might be good for the CI as well, we could potentially do something like
make 2>err.logand check that a commit doesn't introduce new warnings easier, but that's future work.