Batctl 2011.2.0bat-hosts.c
からコンパイルしようとしています。ただし、これは Android NDK rev. の CLANG 3.1 コンパイラによって出力されるエラー メッセージです。8c:
bat-hosts.c:41:1: エラー: 関数宣言子の無効なストレージ クラス指定子
同じ NDK リビジョンの GCC 4.6 から同様のエラー メッセージが表示されます。
41行目は次のとおりです。
static struct hashtable_t *host_hash = NULL;
この構造体へのポインターhashtable_t
(で定義hash.h
) は、任意の関数の外側で static として宣言されNULL
、宣言時にポイントされます。これは有効であることがわかりました。
std
オプションをgnu11
、c11
、gnu1x
、c1x
、およびに設定して GCC/CLANG を実行してみましc99
た。
私の質問は:
コンパイラがこのポインタを関数宣言として識別するのはなぜですか?
前もって感謝します
編集:
hashtable_t
構造体定義:
struct hashtable_t {
struct element_t **table; /* the hashtable itself, with the buckets */
int elements; /* number of elements registered */
int size; /* size of hashtable */
hashdata_compare_cb compare; /* callback to a compare function.
* should compare 2 element datas for their keys,
* return 0 if same and not 0 if not same */
hashdata_choose_cb choose; /* the hashfunction, should return an index based
* on the key in the data of the first argument
* and the size the second */
};
2回目の編集:ご協力いただきありがとうございます。@JonathanLeffler の提案に従って SSCCE を作成した後、問題が追加のライブラリに関係していることがわかりました。追加したことを忘れていました。お時間を無駄にして申し訳ありません:-/
@JonathanLeffler 必要に応じて返信を投稿できます。回答としてマークします。