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

Side by Side Diff: sandbox/linux/seccomp-bpf/syscall.cc

Issue 821693003: replace COMPILE_ASSERT with static_assert in sandbox/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 5 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sandbox/linux/seccomp-bpf/syscall.h" 5 #include "sandbox/linux/seccomp-bpf/syscall.h"
6 6
7 #include <asm/unistd.h> 7 #include <asm/unistd.h>
8 #include <errno.h> 8 #include <errno.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 intptr_t p5, 272 intptr_t p5,
273 intptr_t p6, 273 intptr_t p6,
274 intptr_t p7) { 274 intptr_t p7) {
275 // We rely on "intptr_t" to be the exact size as a "void *". This is 275 // We rely on "intptr_t" to be the exact size as a "void *". This is
276 // typically true, but just in case, we add a check. The language 276 // typically true, but just in case, we add a check. The language
277 // specification allows platforms some leeway in cases, where 277 // specification allows platforms some leeway in cases, where
278 // "sizeof(void *)" is not the same as "sizeof(void (*)())". We expect 278 // "sizeof(void *)" is not the same as "sizeof(void (*)())". We expect
279 // that this would only be an issue for IA64, which we are currently not 279 // that this would only be an issue for IA64, which we are currently not
280 // planning on supporting. And it is even possible that this would work 280 // planning on supporting. And it is even possible that this would work
281 // on IA64, but for lack of actual hardware, I cannot test. 281 // on IA64, but for lack of actual hardware, I cannot test.
282 COMPILE_ASSERT(sizeof(void*) == sizeof(intptr_t), 282 static_assert(sizeof(void*) == sizeof(intptr_t),
283 pointer_types_and_intptr_must_be_exactly_the_same_size); 283 "pointer types and intptr_t must be exactly the same size");
284 284
285 // TODO(nedeljko): Enable use of more than six parameters on architectures 285 // TODO(nedeljko): Enable use of more than six parameters on architectures
286 // where that makes sense. 286 // where that makes sense.
287 #if defined(__mips__) 287 #if defined(__mips__)
288 const intptr_t args[8] = {p0, p1, p2, p3, p4, p5, p6, p7}; 288 const intptr_t args[8] = {p0, p1, p2, p3, p4, p5, p6, p7};
289 #else 289 #else
290 DCHECK_EQ(p6, 0) << " Support for syscalls with more than six arguments not " 290 DCHECK_EQ(p6, 0) << " Support for syscalls with more than six arguments not "
291 "added for this architecture"; 291 "added for this architecture";
292 DCHECK_EQ(p7, 0) << " Support for syscalls with more than six arguments not " 292 DCHECK_EQ(p7, 0) << " Support for syscalls with more than six arguments not "
293 "added for this architecture"; 293 "added for this architecture";
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 404 }
405 405
406 // Set an error status so it can be used outside of this function 406 // Set an error status so it can be used outside of this function
407 *err_ret = err_stat; 407 *err_ret = err_stat;
408 408
409 return ret; 409 return ret;
410 } 410 }
411 #endif // defined(__mips__) 411 #endif // defined(__mips__)
412 412
413 } // namespace sandbox 413 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ('k') | sandbox/linux/seccomp-bpf/syscall_iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698