Last change
on this file since 331 was 331, checked in by coas-nagasima, 6 years ago |
prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc
|
File size:
1.4 KB
|
Rev | Line | |
---|
[331] | 1 | /* $Id$
|
---|
| 2 |
|
---|
| 3 | Tests on left-shift type, written by Vincent Lefevre <vincent@vinc17.net>.
|
---|
| 4 |
|
---|
| 5 | ISO C99 TC3 says: [6.5.7#3] "The integer promotions are performed on
|
---|
| 6 | each of the operands. The type of the result is that of the promoted
|
---|
| 7 | left operand."
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #include <stdio.h>
|
---|
| 11 |
|
---|
| 12 | #define PTYPE(M) ((M) < 0 || -(M) < 0 ? -1 : 1) * (int) sizeof((M)+0)
|
---|
| 13 | #define CHECK(X,T) check(#X, PTYPE(X), PTYPE((X) << (T) 1))
|
---|
| 14 | #define TEST1(X,T) do { CHECK(X,T); CHECK(X,unsigned T); } while (0)
|
---|
| 15 | #define TEST2(X) \
|
---|
| 16 | do \
|
---|
| 17 | { \
|
---|
| 18 | TEST1((X),short); \
|
---|
| 19 | TEST1((X),int); \
|
---|
| 20 | TEST1((X),long); \
|
---|
| 21 | TEST1((X),long long); \
|
---|
| 22 | } \
|
---|
| 23 | while (0)
|
---|
| 24 | #define TEST3(X,T) do { TEST2((T)(X)); TEST2((unsigned T)(X)); } while (0)
|
---|
| 25 | #define TEST4(X) \
|
---|
| 26 | do \
|
---|
| 27 | { \
|
---|
| 28 | TEST3((X),short); \
|
---|
| 29 | TEST3((X),int); \
|
---|
| 30 | TEST3((X),long); \
|
---|
| 31 | TEST3((X),long long); \
|
---|
| 32 | } \
|
---|
| 33 | while (0)
|
---|
| 34 |
|
---|
| 35 | static int debug, nfailed = 0;
|
---|
| 36 |
|
---|
| 37 | static void check (const char *s, int arg1, int shift)
|
---|
| 38 | {
|
---|
| 39 | int failed = arg1 != shift;
|
---|
| 40 | if (debug || failed)
|
---|
| 41 | printf ("%s %d %d\n", s, arg1, shift);
|
---|
| 42 | nfailed += failed;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | int main (int argc, char **argv)
|
---|
| 46 | {
|
---|
| 47 | debug = argc > 1;
|
---|
| 48 | TEST4(1);
|
---|
| 49 | TEST4(-1);
|
---|
| 50 | printf ("%d test(s) failed\n", nfailed);
|
---|
| 51 | return nfailed != 0;
|
---|
| 52 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.