There seems to be a problem using "personality" in a userspace
component (which makes it hard to have a variable number of pins)

code:=================

component test;
option userspace;
license "GPL";

pin in unsigned test-##[16:personality];

;;

void user_mainloop(void) {

    while (1) {
        FOR_ALL_INSTS(){
            test = 2;
        }
    }
}

end:===================

The error during the compile stage is:

/tmp/tmpEkMpyO/test.c:63:32: error: expected ‘)’ before numeric constant

 RTAPI_MP_ARRAY_INT(personality, 64, "personality of each test");

                                ^~~

                                )

Which is a bit puzzling.

Putting the code into godbolt.org suggests that RTAPI_MP_ARRAY_INT expands to:

__attribute__((section(".modinfo"))) const char*
rtapi_info_type_personality = "i";
__attribute__((section(".rtapi_export"))) char
rtapi_exported_rtapi_info_type_personality[] =
"rtapi_info_type_personality";;
__attribute__((section(".modinfo"))) void*
rtapi_info_address_personality = &personality;
__attribute__((section(".rtapi_export"))) char
rtapi_exported_rtapi_info_address_personality[] =
"rtapi_info_address_personality";;;
__attribute__((section(".modinfo"))) int rtapi_info_size_personality = 64;
__attribute__((section(".rtapi_export"))) char
rtapi_exported_rtapi_info_size_personality[] =
"rtapi_info_size_personality";;;
__attribute__((section(".modinfo"))) const char*
rtapi_info_description_personality = "personality of each test";
__attribute__((section(".rtapi_export"))) char
rtapi_exported_rtapi_info_description_personality[] =
"rtapi_info_description_personality";;;;;

Which does not appear to lack a parethesies, but  also doesn't
actually appear to include any code, as such.

By contrast, the same RTAPI_MP_ARRAY_INT in kernel space expands to:

int __dummy_personality;
module_param_array(personality, int, &(__dummy_personality), 0);
__attribute__((section(".modinfo"))) const char*
rtapi_info_description_personality = "personality of each test";
__attribute__((section(".rtapi_export"))) char
rtapi_exported_rtapi_info_description_personality[] =
"rtapi_info_description_personality";;;;

ie, it does at least call module_param_array

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to