Preprocessor source?

cancel
Showing results for 
Search instead for 
Did you mean: 

Preprocessor source?

462 Views
mspenard603
Contributor IV

I have this compiler error I'm trying to narrow down in Mongoose:

   "error: macro “poll” requires 3 arguments, but only 2 given m->ifaces[i]->vtable->poll(m->ifaces[i], timeout_ms);"

And vtable->poll isn't a macro, So something must be overriding it(?)

   struct mg_iface_vtable {
       time_t (*poll)(struct mg_iface *iface, int timeout_ms);

I need to see the pre-processor source with all the macros expanded so I can see where it's taking the definition of "poll" from. Typically, you would add -E to the compiler options. But I've done that, and I'm not seeing anything useful outputted.

Untitled.png

Untitled2.png

Untitled3.png

How does one setup MCUxpresso to see the pre-processor source with all the macros expanded???

0 Kudos
5 Replies

269 Views
Sebastian_Del_Rio
NXP TechSupport
NXP TechSupport

Hello Mike, I hope you're doing well,

 

I tested checking the "Preprocess Only (-E)" checkbox in my project settings and the output files are being generated correctly. Could you please look for those files inside your Debug folder?

You can find said folder here: workspace_folder\project_folder\Debug\source

 

Best regards,

Sebastian

0 Kudos

269 Views
mspenard603
Contributor IV

It turned up in a section of code, LWIP's sockets.h that is disabled by a #ifdef. So how is disabled code finding its way in?!

Untitled.png

Whole sockets.h file should be turned off:

Untitled2.png

0 Kudos

269 Views
mspenard603
Contributor IV

Got them, I needed "-save-temps". So now that I have all my .i files I'm still confused...

It's specifying 2 arguments for poll() in the source:

int mg_mgr_poll(struct mg_mgr *m, int timeout_ms) {
int i, num_calls_before = m->num_calls;

for (i = 0; i < m->num_ifaces; i++) {
m->ifaces[i]->vtable->poll(m->ifaces[i], timeout_ms);
}

return (m->num_calls - num_calls_before);
}

But in my .i file it shows NO arguments:

int mg_mgr_poll(struct mg_mgr *m, int timeout_ms) {
int i, num_calls_before = m->num_calls;

for (i = 0; i < m->num_ifaces; i++) {
m->ifaces[i]->vtable->poll;
}

return (m->num_calls - num_calls_before);
}


Why is MCUxpresso doing this? It says "macro" error. But how do I figure out where its mistakingly changing poll() ?!

error: macro “poll” requires 3 arguments, but only 2 given m->ifaces[i]->vtable->poll(m->ifaces[i], timeout_ms);

0 Kudos

269 Views
converse
Senior Contributor V

Obviously, the compiler is not going to "mistakenly" redefine a macro. There is obviously a definition of poll with 3 arguments in your source code.

The first, most obvious, way is to search for it (there are good search options in the IDE). Failing that, you could always define a poll macro yourself, which will cause the compiler to issue a macro redefinition error and should give you the source location of both macros.

0 Kudos

269 Views
mspenard603
Contributor IV

Obviously I used the word "mistakenly" to personify the compiler as a way to explain the issue. Obviously I used the search tool for the keyword "poll" and it didn't turn up a macro for it. And was looking for a helpful method that would "expose" where this "erroneous" "interaction" is taking place.

0 Kudos