From: Gabe Black Date: Tue, 1 Sep 2020 03:52:24 +0000 (-0700) Subject: test: Fix unittest cprintftime's build. X-Git-Tag: v20.1.0.0~170 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=52f5cd2f67ce4c823fa2d05bc0caf7228896e95b;p=gem5.git test: Fix unittest cprintftime's build. This test, which measures the performance of cprintf vs. sprintf, was missing a couple of includes which were needed for the alarm() and signal() functions, as well as the SIGALRM constant. Also, it was using %#x to print the value of a pointer which gcc complained about when compiling sprintf. This is fixed by changing that format specifier to %p, the specifier to use when printing pointers. Apparently either the implicit conversion to an integer value (which %#x expects) or the size of the type it was converted to weren't good enough for gcc any more. Change-Id: I8eca3479bef2c2fa79f8ef4881bb3ff35d7c54ca Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33897 Reviewed-by: Nikos Nikoleris Reviewed-by: Daniel Carvalho Maintainer: Jason Lowe-Power Tested-by: kokoro --- diff --git a/src/unittest/cprintftime.cc b/src/unittest/cprintftime.cc index 4ad347d1b..f8f14926b 100644 --- a/src/unittest/cprintftime.cc +++ b/src/unittest/cprintftime.cc @@ -26,6 +26,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include + +#include #include #include #include @@ -62,7 +65,7 @@ main() while (!stop) { stringstream result; ccprintf(result, - "this is a %s of %d iterations %3.2f %#x\n", + "this is a %s of %d iterations %3.2f %p\n", "test", iterations, 51.934, &result); iterations += 1; @@ -75,7 +78,7 @@ main() while (!stop) { char result[1024]; sprintf(result, - "this is a %s of %d iterations %3.2f %#x\n", + "this is a %s of %d iterations %3.2f %p\n", "test", iterations, 51.934, &result); iterations += 1;