crashappsec / libcon4m

Base Compiler and Runtime Support for con4m
Apache License 2.0
0 stars 0 forks source link

Fixes to compile on Linux w/ gcc and silence warnings #12

Closed orangematt closed 4 months ago

orangematt commented 4 months ago

A few of the changes here fix compile errors on Linux. Notably there are issues with hatrack.h due to a badly placed #endif and a couple of other Linux-specific things (like not having htonll, for example). Most changes are to silence warnings

I don't have a build environment setup for macOS, but I did check the changes to header includes and endian tests made to base.h with a small test program to make sure they'll work as expected.

It's not obvious, but for min/max, I changed to always use __typeof__(a) to silence sign mismatch in comparison errors. The effect of the comparison is the same, but the compiler doesn't complain this way. Arguably the comparison sites that raise warnings should be fixed to correctly address the warnings, though.