rui314 / 8cc

A Small C Compiler
MIT License
6.12k stars 742 forks source link

make test fails with timestamp error #62

Closed gergo- closed 9 years ago

gergo- commented 9 years ago

When running "make test" after compiling 8cc with GCC (4.8.2 on a current Linux Mint), I get the following failure:

Testing macros ... Failed test/macro.c:29: "Thu Apr 02 18:42:49 2015" expected, but got "Thu Apr 2 18:42:49 2015"

The day of the month is zero-padded in 8cc's get_timestamp function, but GCC's __TIMESTAMP__ macro is space-padded, as documented: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html I note that Clang's documentation does not specify the format of __TIMESTAMP__: http://clang.llvm.org/docs/LanguageExtensions.html but I can't check its actual behavior right now.

rui314 commented 9 years ago

Thanks for reporting. We had a similar bug before (0e069b3359aa4c6566bed7969737a0e7c7e35093). I'll fix later.

rui314 commented 9 years ago

Fixed in 9cd74f7015189d626b79ab126124c476a0cca4bc.