[Reference:<_A368@delegate-ja.ML_>]
Newsgroups: mail-lists.delegate-ja
[DeleGate-Ja] Re: HP-UX での DeleGate (Re: DeleGa te Home Page を拝見いたしまして)
In message <_A368@delegate-ja.ML_>
on 11/30/09(19:15:59) you wrote:
|お疲れ様です。野村です。
どうも、佐藤です。といいますか、公開フォーラム向けのメールとしては、
少し内部情報交換めいたメールが含まれているような... ややや(^^;?
http://www.delegate.org/mail-lists/delegate-ja/368
# 削除したほうが良いようでしたら、おっしゃって下さい。
# 以前に較べますと、フットワークは随分重くなりました(^^;
|標題の件につきまして、
|delegate9.9.6-pre7 をコンパイルしてみました。
...
|>>>>> CFLAGS=-O2 -DQSC
...
|やはり、うまくいきませんでした。
|
|エラー事象
|1:
|"_.c", line 1: error #2094: the size of an array must be greater than zero
| struct{char A[0]; char B[1];}S;
|前回同様サイズがゼロの配列を許容しないコンパイラということで、ひっかかっている。
|などで、"CFLAGSPLUS="がうまくきいていない?
このエラーは、使用するCコンパイラの機能を検査している所で出ているもの
でして、この検査の結果、サイズゼロ配列が不可であることを示す
-DNONAZ0=4
というマクロ定義を自動的に追加して、以降のmakeを進行しています。
ただ、今回の "-DQSC" オプションにおいても、struct 中における、
char buf[0] か char buf[] のいずれかが可能であることが前提でして、
これらが ANSI C もしくは C++ での拡張だとしますと、どちらにも相当
しないコンパイラの場合には、結局不可ということになります。
10年前のDecAlpha(OSF/1)のccでは、後者によりコンパイルを通ったので、
ひょっとしてHP-UXでも、、、と思った次第です。
もし以下で通るようでしたら、しゃんしゃんと言うことで。
|>>>>> | make CFLAGS="-O2 -Ag++"
残念ながら駄目だった場合、
・CC=aC++ とか?
・CC=gcc を使う(結局)
というのが現状での対処法かと思います。
ともかく、現状のDeleGateを make するには、以下の(1)か(2)が、errorでなく
通るような、CC もしくは CFLAGS を選択する必要あります。
struct { char x[0]; char y[1]; } s1; //(1)
struct { char x[]; char y[1]; } s2; //(2)
int main(int ac,char *av[]){ return 0; }
私の手元に有るコンパイラで試してみますと、以下のようになります。
(A) gcc ... buf[] not available
% gcc test.c
test.c:2: error: flexible array member not at end of struct
(B) g++ ... both available
% "g++ test.c" or "gcc -x c++ test.c"
test.c:1: warning: non-local variable '<anonymous struct> s1' uses anonymous type
test.c:2: warning: non-local variable '<anonymous struct> s2' uses anonymous type
(C) icc ... both not avaiable
% icc test.c
test.c(2): error: incomplete type is not allowed
struct { char x[]; char y[1]; } s2;
^
test.c(2): error: incomplete type is not allowed
struct { char x[]; char y[1]; } s2;
^
compilation aborted for /nfs/delegate.all/sz0.c (code 2)
(D) icc -x c++ ... both available (without warning)
(E) cc of OSF/1 ... buf[0] not available
% cc test.c
cc: Error: sz0.c, line 1: In the declaration of "x", the array bound "0" is not a positive integer.
struct { char x[0]; char y[1]; } s1;
--------------^
cc: Warning: sz0.c, line 2: Strict ANSI C extension: The member x has incomplete array type.
struct { char x[]; char y[1]; } s2;
--------------^
HP-UXの新しめのをお使いと思いますので、きっと、コンパイラかオプションの
選択で、回避が可能なのではないかと思います。
ただ、他のOSなどで、どうにも回避が出来ない場合のために、サイズを1にして
コンパイルするオプションでも付けておこうかと思っています(^^;
9 9
┌─┐┬┌──┬┐ //\^^ ( e ); {Do the more with the less -- B. Fuller}
├─┤│└─┐│ / 877m\_< >_ <URL:http://www.delegate.org/delegate/>
┴ └┴──┘┴──────────────────────────────
佐藤豊@情報技術研究部門.産業技術総合研究所(独立行政法人)
|