Shader_Minifier icon indicating copy to clipboard operation
Shader_Minifier copied to clipboard

Remove unused #define

Open laurentlb opened this issue 1 year ago • 4 comments

If there's a #define in a file, but the macro is not used anywhere, we should delete it.

With the preprocessor, this will become common:

#define PRETTIER 1

#ifdef PRETTIER
...
#endif

The preprocessor can evaluate and remove the #ifdef line, but it doesn't know if the macro should be preserved or not.

laurentlb avatar Mar 20 '23 22:03 laurentlb

Gotta implement actual replacement of tokens in the code... Then the #define can always be deleted.

eldritchconundrum avatar Mar 21 '23 00:03 eldritchconundrum

We don't want to remove all defines, just the ones that are not used.

laurentlb avatar Mar 21 '23 00:03 laurentlb

Evaluating and removing defines could yield a smaller output.

eldritchconundrum avatar Mar 21 '23 00:03 eldritchconundrum

Or in many cases, larger...

In any case, inlining the defines is an independent feature request.

laurentlb avatar Mar 21 '23 00:03 laurentlb