Parameter name missing error for return of enum function

I have a driver using hrtimer. I am getting the parameter name omitted for the following function definition

enum hrtimer_restart (hr_toggle)(struct hrtimer *hrt)
{

    <some code>

}

      

What's wrong with this code? I gave the correct structure.

Update: I also tried using the same without parentheses for the function name. The result is the same. I am using the standard console gcc compiler now available in ubuntu arm-linux-gnueabi-gcc

+3


source to share


2 answers


I don't know how it works, but changing * hrt to * t.

enum hrtimer_restart (hr_toggle)(struct hrtimer *t)

      



Works well. Strange but true. The paranesia around hr_toggle doesn't matter.

0


source


"Parameter name omitted" is an error given by GCC family compilers when (naturally) a parameter name is omitted from a function definition, which is not valid in C.

Recent versions of Clang and GCC do not actually mind the above declaration (assuming definitions for struct hrtimer

and enum hrtimer_restart

), so I am assuming you are not using one of them and are using a different compiler instead, which does not quite match the C specification. The code in the question is correct and should not be rejected.



If so, it might not recognize that the function name is allowed to be in parentheses and misparsed hrtimer_restart

as the function name, but hr_toggle

as the type of the first parameter (and ... hasn 't until the remark enum

is the return type. before giving up is a weird order of doing things).

Removing the parentheses from the name, or preferably changing your compiler / compiler options to something more refined, should deal with this.

+1


source







All Articles