Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: tests/mmap/mmap_test.cc

Issue 1148953002: Cast pointers used with %p format strings to void * (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/mmap/mmap_prot_test.c ('k') | tests/stack_alignment/stack_alignment_asm_test.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <limits.h> 10 #include <limits.h>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 "nonsfi_loader with host libc\n"); 74 "nonsfi_loader with host libc\n");
75 return; 75 return;
76 } 76 }
77 77
78 int rc = nacl_exception_set_handler(exception_handler); 78 int rc = nacl_exception_set_handler(exception_handler);
79 assert(rc == 0); 79 assert(rc == 0);
80 if (!setjmp(g_jmp_buf)) { 80 if (!setjmp(g_jmp_buf)) {
81 char value = *addr; 81 char value = *addr;
82 /* If we reach here, the assertion failed. */ 82 /* If we reach here, the assertion failed. */
83 fprintf(stderr, "Address %p was readable, and contained %i\n", 83 fprintf(stderr, "Address %p was readable, and contained %i\n",
84 addr, value); 84 static_cast<void *>(addr), value);
Derek Schuff 2015/05/20 22:03:44 so, you can't cast away volatile like this with an
khimg 2015/05/20 22:16:18 Ugh. uintptr_t would properly require not %x but %
Derek Schuff 2015/05/22 16:38:49 agreed; switched to c-style casts with comment.
85 exit(1); 85 exit(1);
86 } 86 }
87 /* 87 /*
88 * Clean up: Unregister the exception handler so that we do not 88 * Clean up: Unregister the exception handler so that we do not
89 * accidentally return through g_jmp_buf if an exception occurs. 89 * accidentally return through g_jmp_buf if an exception occurs.
90 */ 90 */
91 rc = nacl_exception_set_handler(NULL); 91 rc = nacl_exception_set_handler(NULL);
92 assert(rc == 0); 92 assert(rc == 0);
93 } 93 }
94 94
(...skipping 19 matching lines...) Expand all
114 "nonsfi_loader with host libc\n"); 114 "nonsfi_loader with host libc\n");
115 return; 115 return;
116 } 116 }
117 117
118 int rc = nacl_exception_set_handler(exception_handler); 118 int rc = nacl_exception_set_handler(exception_handler);
119 assert(rc == 0); 119 assert(rc == 0);
120 if (!setjmp(g_jmp_buf)) { 120 if (!setjmp(g_jmp_buf)) {
121 *addr = value; 121 *addr = value;
122 /* If we reach here, the assertion failed. */ 122 /* If we reach here, the assertion failed. */
123 fprintf(stderr, "Address %p was writable, %i was written\n", 123 fprintf(stderr, "Address %p was writable, %i was written\n",
124 addr, value); 124 static_cast<void *>(addr), value);
125 exit(1); 125 exit(1);
126 } 126 }
127 /* 127 /*
128 * Clean up: Unregister the exception handler so that we do not 128 * Clean up: Unregister the exception handler so that we do not
129 * accidentally return through g_jmp_buf if an exception occurs. 129 * accidentally return through g_jmp_buf if an exception occurs.
130 */ 130 */
131 rc = nacl_exception_set_handler(NULL); 131 rc = nacl_exception_set_handler(NULL);
132 assert(rc == 0); 132 assert(rc == 0);
133 } 133 }
134 134
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // run the full test suite 634 // run the full test suite
635 passed = testSuite(); 635 passed = testSuite();
636 636
637 if (passed) { 637 if (passed) {
638 printf("All tests PASSED\n"); 638 printf("All tests PASSED\n");
639 exit(0); 639 exit(0);
640 } 640 }
641 printf("One or more tests FAILED\n"); 641 printf("One or more tests FAILED\n");
642 exit(-1); 642 exit(-1);
643 } 643 }
OLDNEW
« no previous file with comments | « tests/mmap/mmap_prot_test.c ('k') | tests/stack_alignment/stack_alignment_asm_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698