Try to catch missing std includes on travis
By defining LWIP_PLATFORM_ASSERT to a function, we can prevent arch.h from including stdio.h and stdlib.h Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
@@ -326,4 +326,10 @@ void sys_unlock_tcpip_core(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LWIP_PLATFORM_ASSERT
|
||||
/* Define LWIP_PLATFORM_ASSERT to something to catch missing stdio.h includes */
|
||||
void lwip_example_app_platform_assert(const char *msg, int line, const char *file);
|
||||
#define LWIP_PLATFORM_ASSERT(x) lwip_example_app_platform_assert(x, __LINE__, __FILE__)
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_LWIPOPTS_H */
|
||||
|
||||
@@ -760,3 +760,13 @@ int main(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function is only required to prevent arch.h including stdio.h
|
||||
* (which it does if LWIP_PLATFORM_ASSERT is undefined)
|
||||
*/
|
||||
void lwip_example_app_platform_assert(const char *msg, int line, const char *file)
|
||||
{
|
||||
printf("Assertion \"%s\" failed at line %d in %s\n", msg, line, file);
|
||||
fflush(NULL);
|
||||
abort();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user