OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 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 /* | 7 /* |
8 * NaCl Basic Common Definitions. | 8 * NaCl Basic Common Definitions. |
9 */ | 9 */ |
10 #ifndef NATIVE_CLIENT_SRC_INCLUDE_NACL_BASE_H_ | 10 #ifndef NATIVE_CLIENT_SRC_INCLUDE_NACL_BASE_H_ |
11 #define NATIVE_CLIENT_SRC_INCLUDE_NACL_BASE_H_ 1 | 11 #define NATIVE_CLIENT_SRC_INCLUDE_NACL_BASE_H_ 1 |
12 | 12 |
13 /* The following part is necessary for Mips because Mips compilers by default | |
Mark Seaborn
2012/09/08 02:43:14
Nit: the NaCl comment style is
/*
* blah...
*/
s
petarj
2012/09/11 16:58:13
Done.
| |
14 * preprocess "mips" string and replace it with character '1'. To allow using | |
15 * "NACL_mips" macro, we need to undefine "mips" macro. | |
16 */ | |
17 | |
18 #ifdef mips | |
19 # undef mips | |
20 #endif | |
21 | |
13 /* | 22 /* |
14 * putting extern "C" { } in header files make emacs want to indent | 23 * putting extern "C" { } in header files make emacs want to indent |
15 * everything, which looks odd. rather than putting in fancy syntax | 24 * everything, which looks odd. rather than putting in fancy syntax |
16 * recognition in c-mode, we just use the following macros. | 25 * recognition in c-mode, we just use the following macros. |
17 * | 26 * |
18 * TODO: before releasing code, we should provide a defintion of a | 27 * TODO: before releasing code, we should provide a defintion of a |
19 * function to be called from c-mode-hook that will make it easy to | 28 * function to be called from c-mode-hook that will make it easy to |
20 * follow our coding style (which we also need to document). | 29 * follow our coding style (which we also need to document). |
21 */ | 30 */ |
22 #ifdef __cplusplus | 31 #ifdef __cplusplus |
(...skipping 27 matching lines...) Expand all Loading... | |
50 * #if-directives can work only with numerical values but not with strings e.g. | 59 * #if-directives can work only with numerical values but not with strings e.g. |
51 * "NACL_x86"; therefore, we convert strings into integers. Whenever you use | 60 * "NACL_x86"; therefore, we convert strings into integers. Whenever you use |
52 * NACL_ARCH or NACL_arm, you need to include this header. | 61 * NACL_ARCH or NACL_arm, you need to include this header. |
53 */ | 62 */ |
54 #define NACL_MERGE(x, y) x ## y | 63 #define NACL_MERGE(x, y) x ## y |
55 #define NACL_ARCH(x) NACL_MERGE(NACL_, x) | 64 #define NACL_ARCH(x) NACL_MERGE(NACL_, x) |
56 /* | 65 /* |
57 * Avoid using 0, because "#if FOO == 0" is true if FOO is undefined, and does | 66 * Avoid using 0, because "#if FOO == 0" is true if FOO is undefined, and does |
58 * not produce a warning or error. | 67 * not produce a warning or error. |
59 */ | 68 */ |
60 #define NACL_x86 1 | 69 #define NACL_x86 1 |
Mark Seaborn
2012/09/08 02:43:14
Nit: no need to change the indentation on the exis
petarj
2012/09/11 16:58:13
Done.
| |
61 #define NACL_arm 2 | 70 #define NACL_arm 2 |
71 #define NACL_mips 3 | |
62 | 72 |
63 /***************************************************************************** | 73 /***************************************************************************** |
64 * Architecture name encodings. | 74 * Architecture name encodings. |
65 * | 75 * |
66 * NACL_ARCH_NAME(name, arch) - Name specific to the given architecture, | 76 * NACL_ARCH_NAME(name, arch) - Name specific to the given architecture, |
67 * NACL_SUBARCH_NAME(name, arch, subarch) - Name specific to the | 77 * NACL_SUBARCH_NAME(name, arch, subarch) - Name specific to the |
68 * given architecture and subarchitecture. | 78 * given architecture and subarchitecture. |
69 */ | 79 */ |
70 #define NACL_MERGE_ARCH_NAME(name, arch) NaCl_ ## name ## _ ## arch | 80 #define NACL_MERGE_ARCH_NAME(name, arch) NaCl_ ## name ## _ ## arch |
71 #define NACL_ARCH_NAME(name, arch) NACL_MERGE_ARCH_NAME(name, arch) | 81 #define NACL_ARCH_NAME(name, arch) NACL_MERGE_ARCH_NAME(name, arch) |
72 #define NACL_MERGE_SUBARCH_NAME(name, arch, subarch) \ | 82 #define NACL_MERGE_SUBARCH_NAME(name, arch, subarch) \ |
73 NaCl_ ## name ## _ ## arch ## _ ## subarch | 83 NaCl_ ## name ## _ ## arch ## _ ## subarch |
74 #define NACL_SUBARCH_NAME(name, arch, subarch) \ | 84 #define NACL_SUBARCH_NAME(name, arch, subarch) \ |
75 NACL_MERGE_SUBARCH_NAME(name, arch, subarch) | 85 NACL_MERGE_SUBARCH_NAME(name, arch, subarch) |
76 | 86 |
77 #endif /* NATIVE_CLIENT_SRC_INCLUDE_NACL_BASE_H_ */ | 87 #endif /* NATIVE_CLIENT_SRC_INCLUDE_NACL_BASE_H_ */ |
OLD | NEW |