Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jan 2019 23:06:39 +0000 (UTC)
From:      Enji Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343365 - head/lib/libc/tests/sys
Message-ID:  <201901232306.x0NN6dJ0077569@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed Jan 23 23:06:39 2019
New Revision: 343365
URL: https://svnweb.freebsd.org/changeset/base/343365

Log:
  Unbreak the gcc build with sendfile_test after r343362
  
  gcc 8.x is more pedantic than clang 7.x with format strings and the tests
  passed `void*` variables while supplying `%s` (which is technically
  incorrect).
  
  Make the affected `void*` variables use `char*` storage instead to address
  this issue, as the compiler will upcast the values to `char*`.
  
  MFC after:	1 month
  MFC with:	r343362
  Approved by:	emaste (mentor; implicit)
  Reviewed by:	asomers
  Differential Revision: https://reviews.freebsd.org/D18934

Modified:
  head/lib/libc/tests/sys/sendfile_test.c

Modified: head/lib/libc/tests/sys/sendfile_test.c
==============================================================================
--- head/lib/libc/tests/sys/sendfile_test.c	Wed Jan 23 22:19:49 2019	(r343364)
+++ head/lib/libc/tests/sys/sendfile_test.c	Wed Jan 23 23:06:39 2019	(r343365)
@@ -195,7 +195,7 @@ setup_server(int domain, int type, int port)
 static void
 server_cat(const char *dest_filename, int server_sock, size_t len)
 {
-	void *buffer;
+	char *buffer;
 	int recv_sock;
 	ssize_t received_bytes;
 
@@ -268,7 +268,7 @@ static void
 verify_source_and_dest(const char* dest_filename, int src_fd, off_t offset,
     size_t nbytes)
 {
-	void *dest_pointer, *src_pointer;
+	char *dest_pointer, *src_pointer;
 	off_t dest_file_size, src_file_size;
 	size_t length;
 	int dest_fd;
@@ -384,7 +384,7 @@ ATF_TC_BODY(fd_positive_file_v6, tc)
 static void
 fd_positive_shm_test(int domain)
 {
-	void *shm_pointer;
+	char *shm_pointer;
 	off_t offset;
 	size_t nbytes, pattern_size;
 	pid_t server_pid;
@@ -687,9 +687,9 @@ hdtr_positive_test(int domain)
 		client_sock = setup_tcp_client(domain, port);
 
 		rc = asprintf(&pattern, "%s%s%s",
-		    testcases[i].include_headers ? headers[0].iov_base : "",
+		    testcases[i].include_headers ? (char *)headers[0].iov_base : "",
 		    DETERMINISTIC_PATTERN,
-		    testcases[i].include_trailers ? trailers[0].iov_base : "");
+		    testcases[i].include_trailers ? (char *)trailers[0].iov_base : "");
 		ATF_REQUIRE_MSG(rc != -1, "asprintf failed: %s", strerror(errno));
 
 		atf_utils_create_file(SOURCE_FILE ".full", "%s", pattern);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901232306.x0NN6dJ0077569>