Last change
on this file since 455 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.3 KB
|
Rev | Line | |
---|
[331] | 1 | #include <stdio.h>
|
---|
| 2 |
|
---|
| 3 | enum fred
|
---|
| 4 | {
|
---|
| 5 | a,
|
---|
| 6 | b,
|
---|
| 7 | c,
|
---|
| 8 | d,
|
---|
| 9 | e = 54,
|
---|
| 10 | f = 73,
|
---|
| 11 | g,
|
---|
| 12 | h
|
---|
| 13 | };
|
---|
| 14 |
|
---|
| 15 | /* All following uses of enum efoo should compile
|
---|
| 16 | without warning. While forward enums aren't ISO C,
|
---|
| 17 | it's accepted by GCC also in strict mode, and only warned
|
---|
| 18 | about with -pedantic. This happens in the real world. */
|
---|
| 19 | /* Strict ISO C doesn't allow this kind of forward declaration of
|
---|
| 20 | enums, but GCC accepts it (and gives only pedantic warning), and
|
---|
| 21 | it occurs in the wild. */
|
---|
| 22 | enum efoo;
|
---|
| 23 | struct Sforward_use {
|
---|
| 24 | int (*fmember) (enum efoo x);
|
---|
| 25 | };
|
---|
| 26 |
|
---|
| 27 | extern enum efoo it_real_fn(void);
|
---|
| 28 | enum efoo {
|
---|
| 29 | ONE,
|
---|
| 30 | TWO,
|
---|
| 31 | };
|
---|
| 32 | struct S2 {
|
---|
| 33 | enum efoo (*f2) (void);
|
---|
| 34 | };
|
---|
| 35 | void should_compile(struct S2 *s)
|
---|
| 36 | {
|
---|
| 37 | s->f2 = it_real_fn;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | enum efoo it_real_fn(void)
|
---|
| 41 | {
|
---|
| 42 | return TWO;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | static unsigned int deref_uintptr(unsigned int *p)
|
---|
| 46 | {
|
---|
| 47 | return *p;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | enum Epositive {
|
---|
| 51 | epos_one, epos_two
|
---|
| 52 | };
|
---|
| 53 |
|
---|
| 54 | int main()
|
---|
| 55 | {
|
---|
| 56 | enum fred frod;
|
---|
| 57 | enum Epositive epos = epos_two;
|
---|
| 58 |
|
---|
| 59 | printf("%d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h);
|
---|
| 60 | /* printf("%d\n", frod); */
|
---|
| 61 | frod = 12;
|
---|
| 62 | printf("%d\n", frod);
|
---|
| 63 | frod = e;
|
---|
| 64 | printf("%d\n", frod);
|
---|
| 65 |
|
---|
| 66 | /* Following should compile without warning. */
|
---|
| 67 | printf ("enum to int: %u\n", deref_uintptr(&epos));
|
---|
| 68 |
|
---|
| 69 | return 0;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
|
---|
Note:
See
TracBrowser
for help on using the repository browser.