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

Side by Side Diff: src/include/portability.h

Issue 6937003: modified nacl_sync.h to have NACL_WUR for all functions that return a (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/include/nacl_compiler_annotations.h ('k') | src/shared/imc/sigpipe_test.cc » ('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 2008, Google Inc. 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * All rights reserved. 3 * Use of this source code is governed by a BSD-style license that can be
4 * 4 * found in the LICENSE file.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 5 */
31 6
32 7
33 /* 8 /*
34 * This file should be at the top of the #include group, followed by 9 * This file should be at the top of the #include group, followed by
35 * standard system #include files, then by native client specific 10 * standard system #include files, then by native client specific
36 * includes. 11 * includes.
37 * 12 *
38 * TODO(gregoryd): explain why. (Something to do with windows include 13 * TODO(gregoryd): explain why. (Something to do with windows include
39 * files, to be reconstructed.) 14 * files, to be reconstructed.)
40 */ 15 */
41 16
42 #ifndef NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_H_ 17 #ifndef NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_H_
43 #define NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_H_ 1 18 #define NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_H_ 1
44 19
45 #include <stdlib.h> 20 #include <stdlib.h>
46 21
47 #include "native_client/src/include/nacl_base.h" 22 #include "native_client/src/include/nacl_base.h"
48 #ifdef __native_client__ 23 #ifdef __native_client__
49 #include <bits/wordsize.h> 24 #include <bits/wordsize.h>
50 #else 25 #else
51 #include "native_client/src/trusted/service_runtime/include/bits/wordsize.h" 26 #include "native_client/src/trusted/service_runtime/include/bits/wordsize.h"
52 #endif 27 #endif
53 28
29 #include "native_client/src/include/nacl_compiler_annotations.h"
30
54 #if NACL_WINDOWS 31 #if NACL_WINDOWS
55 /* disable warnings for deprecated functions like getenv, etc. */ 32 /* disable warnings for deprecated functions like getenv, etc. */
56 #pragma warning(disable : 4996) 33 #pragma warning(disable : 4996)
57 # include <malloc.h> 34 # include <malloc.h>
58 /* TODO: eliminate port_win.h */ 35 /* TODO: eliminate port_win.h */
59 # include "native_client/src/include/win/port_win.h" 36 # include "native_client/src/include/win/port_win.h"
60 #else 37 #else
61 # include <sys/types.h> 38 # include <sys/types.h>
62 # include <stdint.h> 39 # include <stdint.h>
63 # include <unistd.h> 40 # include <unistd.h>
64 # include <sys/time.h> 41 # include <sys/time.h>
65 #endif /*NACL_WINDOWS*/ 42 #endif /*NACL_WINDOWS*/
66 43
67 /* MSVC supports "inline" only in C++ */
68 #if NACL_WINDOWS
69 # define INLINE __forceinline
70 #else
71 # define INLINE __inline__
72 #endif
73
74 #if NACL_WINDOWS
75 # define DLLEXPORT __declspec(dllexport)
76 #elif defined(NACL_LINUX) || defined(NACL_OSX)
77 # define DLLEXPORT __attribute__ ((visibility("default")))
78 #elif defined(__native_client__)
79 /* do nothing */
80 #else
81 # error "what platform?"
82 #endif
83
84 #if NACL_WINDOWS
85 # define ATTRIBUTE_FORMAT_PRINTF(m, n)
86 #else
87 # define ATTRIBUTE_FORMAT_PRINTF(m, n) __attribute__((format(printf, m, n)))
88 #endif
89
90 #if NACL_WINDOWS
91 # define UNREFERENCED_PARAMETER(P) (P)
92 #else
93 # define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0)
94 #endif
95
96 #if NACL_WINDOWS
97 # define NORETURN __declspec(noreturn)
98 #else
99 # define NORETURN __attribute__((noreturn)) /* assumes gcc */
100 # define _cdecl /* empty */
101 #endif
102
103 #if NACL_WINDOWS
104 # define THREAD __declspec(thread)
105 #else
106 # define THREAD __thread
107 # define WINAPI
108 #endif
109
110 #if NACL_WINDOWS
111 # define NACL_WUR
112 #else
113 # define NACL_WUR __attribute__((__warn_unused_result__))
114 #endif
115
116 /* 44 /*
117 * Per C99 7.8.14, define __STDC_CONSTANT_MACROS before including <stdint.h> 45 * Per C99 7.8.14, define __STDC_CONSTANT_MACROS before including <stdint.h>
118 * to get the INTn_C and UINTn_C macros for integer constants. It's difficult 46 * to get the INTn_C and UINTn_C macros for integer constants. It's difficult
119 * to guarantee any specific ordering of header includes, so it's difficult to 47 * to guarantee any specific ordering of header includes, so it's difficult to
120 * guarantee that the INTn_C macros can be defined by including <stdint.h> at 48 * guarantee that the INTn_C macros can be defined by including <stdint.h> at
121 * any specific point. Provide GG_INTn_C macros instead. 49 * any specific point. Provide GG_INTn_C macros instead.
122 */ 50 */
123 51
124 #define GG_INT8_C(x) (x) 52 #define GG_INT8_C(x) (x)
125 #define GG_INT16_C(x) (x) 53 #define GG_INT16_C(x) (x)
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 * macros for run-time error detectors (such as Valgrind/Memcheck). 282 * macros for run-time error detectors (such as Valgrind/Memcheck).
355 */ 283 */
356 #if defined(_DEBUG) && NACL_LINUX 284 #if defined(_DEBUG) && NACL_LINUX
357 #include "native_client/src/third_party/valgrind/memcheck.h" 285 #include "native_client/src/third_party/valgrind/memcheck.h"
358 #define NACL_MAKE_MEM_UNDEFINED(a, b) VALGRIND_MAKE_MEM_UNDEFINED(a, b) 286 #define NACL_MAKE_MEM_UNDEFINED(a, b) VALGRIND_MAKE_MEM_UNDEFINED(a, b)
359 #else 287 #else
360 #define NACL_MAKE_MEM_UNDEFINED(a, b) 288 #define NACL_MAKE_MEM_UNDEFINED(a, b)
361 #endif 289 #endif
362 290
363 #endif /* NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_H_ */ 291 #endif /* NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_H_ */
OLDNEW
« no previous file with comments | « src/include/nacl_compiler_annotations.h ('k') | src/shared/imc/sigpipe_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698