Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC 12 error in saimetadatatest.c #1995

Open
saiarcot895 opened this issue Apr 16, 2024 · 1 comment
Open

GCC 12 error in saimetadatatest.c #1995

saiarcot895 opened this issue Apr 16, 2024 · 1 comment

Comments

@saiarcot895
Copy link
Contributor

With GCC 12, there is a compiler error in saimetadatatest.c generated code. Compiler error:

saimetadatatest.c: In function 'api_name_test':
saimetadatatest.c:6:15: error: dangling pointer 'dummy' to 'ge' may be used [-Werror=dangling-pointer=]
    6 | #define PP(x) printf("%p\n", (x));
      |               ^~~~~~~~~~~~~~~~~~~
saimetadatatest.c:3533:5: note: in expansion of macro 'PP'
 3533 |     PP(dummy);
      |     ^~
saimetadatatest.c:3514:40: note: 'ge' declared here
 3514 |         sai_get_vip_entry_attribute_fn ge = NULL;
      |                                        ^~
cc1: all warnings being treated as errors
make: *** [Makefile:140: saimetadatatest.o] Error 1
        vip_entry_create_fn create = dash_vip_api.create_vip_entry;
        vip_entry_remove_fn remove = dash_vip_api.remove_vip_entry;
        vip_entry_set_fn set = dash_vip_api.set_vip_entry_attribute;
        vip_entry_get_fn get = dash_vip_api.get_vip_entry_attribute;
        sai_create_vip_entry_fn cr = NULL;
        sai_remove_vip_entry_fn re = NULL;
        sai_set_vip_entry_attribute_fn se = NULL;
        sai_get_vip_entry_attribute_fn ge = NULL; // Line 3514
        dummy = &create;
        dummy = &remove;
        dummy = &set;
        dummy = &get;
        dummy = &cr;
        dummy = &re;
        dummy = &se;
        dummy = ≥
        checked[(int)SAI_OBJECT_TYPE_VIP_ENTRY] = SAI_OBJECT_TYPE_VIP_ENTRY;
    }
    int index = SAI_OBJECT_TYPE_NULL;
    for (; index < (int)SAI_OBJECT_TYPE_EXTENSIONS_MAX; ++index)
    {
        printf("checking: %s checked (%d) == index (%d)\n",
             sai_metadata_enum_sai_object_type_t.valuesnames[index],
             checked[index],(sai_object_type_t)index);
        TEST_ASSERT_TRUE(checked[index] == (sai_object_type_t)index, "not all objects were processed");
    }
    PP(dummy); // Line 3533
}
@kcudnik
Copy link
Collaborator

kcudnik commented Apr 17, 2024

I made attempt to fix this: #1996, could you test that ?

kcudnik added a commit that referenced this issue Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants