View Issue Details

IDProjectCategoryView StatusLast Update
0000895LDMud 3.5LPC Compiler/Preprocessorpublic2021-09-30 22:19
Reporterparadox Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Summary0000895: Pragma to detect unused variables/functions
DescriptionI'm not sure how feasible this is to implement but it would be great if there was an opt-in #pragma directive that could be used to tell the LPC compiler/preprocessor you'd like unused variables or functions to be considered an error (or even a warning!).

Thanks for all the work on LDMud :-)
Steps To ReproduceCompile a program that has variables or functions that are not used. Observe there is no warning/indication of a problem.
TagsNo tags attached.

Activities

zesstra

2021-09-30 22:12

administrator   ~0002657

LDMud 3.6.3 introduced the pragma warn_unused_variables which does this for unused variables.

Unused functions are difficult, because they could be used by call_other or inheritance. Only in case of private functions, a warning would be possible. I am not sure, that limited use case warrants the effort.

paradox

2021-09-30 22:16

reporter   ~0002658

> LDMud 3.6.3 introduced the pragma warn_unused_variables which does this for unused variables.

Oh! Thank you. I had missed that.

> Unused functions are difficult, because they could be used by call_other or inheritance. Only in case of private functions, a warning would be possible. I am not sure, that limited use case warrants the effort.

This makes sense to me. Honestly I was most interested in unused variables.

Thanks Zesstra!

paradox

2021-09-30 22:19

reporter   ~0002659

Detecting unused functions for LPC is tricky due to runtime call_other/inheritance.

Detecting unused variables is already supported in 3.6.3+ with pragma warn_unused_variables. I missed this because I checked 'man pragma' on 3.5.4.

I think we can close this out.

Issue History

Date Modified Username Field Change
2021-09-30 21:49 paradox New Issue
2021-09-30 22:12 zesstra Note Added: 0002657
2021-09-30 22:16 paradox Note Added: 0002658
2021-09-30 22:19 paradox Status new => closed
2021-09-30 22:19 paradox Resolution open => fixed
2021-09-30 22:19 paradox Note Added: 0002659