Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/33897 )

Change subject: test: Fix unittest cprintftime's build.
......................................................................

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
---
M src/unittest/cprintftime.cc
1 file changed, 5 insertions(+), 2 deletions(-)



diff --git a/src/unittest/cprintftime.cc b/src/unittest/cprintftime.cc
index 4ad347d..f8f1492 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 <unistd.h>
+
+#include <csignal>
 #include <iostream>
 #include <list>
 #include <sstream>
@@ -62,7 +65,7 @@
     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 @@
     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;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33897
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8eca3479bef2c2fa79f8ef4881bb3ff35d7c54ca
Gerrit-Change-Number: 33897
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to