This commit lets lcc correctly diagnose the following code:
typedef void (*fp_t)(void);
fp_t func(fp_t param)
{
return (void *)0; /* line A */
}
int main(void)
{
fp_t t = (void *)0; /* line B */
t = (void *)0; /* line C */
return func((void *)0) /* line D */
== (void *)0;
}
According to the Standard, the commented lines above should not be considered non-portable while lcc says:
5: warning: conversion from `pointer to void' to `pointer to void function(void)' is compiler dependent
10: warning: conversion from `pointer to void' to `pointer to void function(void)' is compiler dependent
11: warning: conversion from `pointer to void' to `pointer to void function(void)' is compiler dependent
12: warning: conversion from `pointer to void' to `pointer to void function(void)' is compiler dependent
EDIT: an example regarding a conditional expression and NPC has been removed because it was wrong; constant expressions can be or have conditional expressions. No problem with them in lcc.
This commit lets lcc correctly diagnose the following code:
According to the Standard, the commented lines above should not be considered non-portable while lcc says:
EDIT: an example regarding a conditional expression and NPC has been removed because it was wrong; constant expressions can be or have conditional expressions. No problem with them in lcc.