Search code examples
carmtypeofrvds

Function "typeof" declared implicitly on RVDS 5.01


I was compiling modem codes with ARM compiler for android phones.
I got the error below:

function "typeof" declared implicitly

Then I though I should use __typeof__. But I got the same error:

function "__typeof__" declared implicitly

I even tried __typeof. But none of them works.

Why?

The compiler is RVDS 5.01. The command line is contained in some scripts.

The error message is:

"/opt2/huanglianjun/PD1401V-modem-1.2.1.c1/boot_images/core/storage/ext4/src/com‌​mon/div64.h", line 47:
Error: #223-D: function "typeof" declared implicitly.

The code is :

#define do_div(n,base) do{  \ 
      uint32_t __base = (base); \ 
      uint32_t __rem;   \ 
      (void)(((typeof((n)) *)0) == ((uint64_t *)0));    \ 
      if (((n) >> 32) == 0) {   \ 
          __rem = (uint32_t)(n) % __base;   \ 
          (n) = (uint32_t)(n) / __base; \ 
      } else    \ 
          __rem = __div64_32(&(n), __base); \ 
          __rem;    \ 
    }while(0)

Solution

  • If I read the documentation right, typeof is supported since at least RVDS 3.0, but you need to enable GNU mode by passing the --gnu flag to armcc.