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

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: use C-style everywhere 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 /* C-style cast, because C++ casts can't cast away volatile */
85 (void *) addr, value);
85 exit(1); 86 exit(1);
86 } 87 }
87 /* 88 /*
88 * Clean up: Unregister the exception handler so that we do not 89 * Clean up: Unregister the exception handler so that we do not
89 * accidentally return through g_jmp_buf if an exception occurs. 90 * accidentally return through g_jmp_buf if an exception occurs.
90 */ 91 */
91 rc = nacl_exception_set_handler(NULL); 92 rc = nacl_exception_set_handler(NULL);
92 assert(rc == 0); 93 assert(rc == 0);
93 } 94 }
94 95
(...skipping 19 matching lines...) Expand all
114 "nonsfi_loader with host libc\n"); 115 "nonsfi_loader with host libc\n");
115 return; 116 return;
116 } 117 }
117 118
118 int rc = nacl_exception_set_handler(exception_handler); 119 int rc = nacl_exception_set_handler(exception_handler);
119 assert(rc == 0); 120 assert(rc == 0);
120 if (!setjmp(g_jmp_buf)) { 121 if (!setjmp(g_jmp_buf)) {
121 *addr = value; 122 *addr = value;
122 /* If we reach here, the assertion failed. */ 123 /* If we reach here, the assertion failed. */
123 fprintf(stderr, "Address %p was writable, %i was written\n", 124 fprintf(stderr, "Address %p was writable, %i was written\n",
124 addr, value); 125 /* C-style cast, because C++ casts can't cast away volatile */
126 (void *) addr, value);
125 exit(1); 127 exit(1);
126 } 128 }
127 /* 129 /*
128 * Clean up: Unregister the exception handler so that we do not 130 * Clean up: Unregister the exception handler so that we do not
129 * accidentally return through g_jmp_buf if an exception occurs. 131 * accidentally return through g_jmp_buf if an exception occurs.
130 */ 132 */
131 rc = nacl_exception_set_handler(NULL); 133 rc = nacl_exception_set_handler(NULL);
132 assert(rc == 0); 134 assert(rc == 0);
133 } 135 }
134 136
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // run the full test suite 636 // run the full test suite
635 passed = testSuite(); 637 passed = testSuite();
636 638
637 if (passed) { 639 if (passed) {
638 printf("All tests PASSED\n"); 640 printf("All tests PASSED\n");
639 exit(0); 641 exit(0);
640 } 642 }
641 printf("One or more tests FAILED\n"); 643 printf("One or more tests FAILED\n");
642 exit(-1); 644 exit(-1);
643 } 645 }
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