iqbal-lab/Mykrobe-predictor

Code to remove from code-generator

Closed this issue · 5 comments

New warnings on tip of master

src/predictor/staph/antibiotics.c:18: warning: enumeration value ‘unspecified_gpg’ not handled in switch
src/predictor/staph/antibiotics.c: In function ‘is_erythromycin_susceptible’:
src/predictor/staph/antibiotics.c:635: warning: unused variable ‘I’
src/predictor/staph/antibiotics.c: In function ‘is_clindamycin_susceptible’:
src/predictor/staph/antibiotics.c:747: warning: unused variable ‘I’
src/predictor/staph/antibiotics.c: In function ‘is_gentamicin_susceptible’:
src/predictor/staph/antibiotics.c:844: warning: unused variable ‘I’
src/predictor/staph/antibiotics.c: In function ‘is_biocides_susceptible’:
src/predictor/staph/antibiotics.c:943: warning: unused variable ‘I’
src/predictor/staph/antibiotics.c: In function ‘is_chloramphenicol_susceptible’:
src/predictor/staph/antibiotics.c:1040: warning: unused variable ‘I’
src/predictor/staph/antibiotics.c: In function ‘is_penicillin_susceptible’:
src/predictor/staph/antibiotics.c:1252: warning: unused variable ‘i’
src/predictor/staph/antibiotics.c:1251: warning: unused variable ‘min_conf’
src/predictor/staph/antibiotics.c:1250: warning: unused variable ‘max_sus_conf’
src/predictor/staph/antibiotics.c: In function ‘is_mupirocin_susceptible’:
src/predictor/staph/antibiotics.c:1332: warning: unused variable ‘I’
src/predictor/staph/antibiotics.c: In function ‘is_spectinomycin_susceptible’:
src/predictor/staph/antibiotics.c:1425: warning: unused variable ‘i’
src/predictor/staph/antibiotics.c:1424: warning: unused variable ‘min_conf’
src/predictor/staph/antibiotics.c:1423: warning: unused variable ‘max_sus_conf’
src/predictor/staph/antibiotics.c: In function ‘is_trimethoprim_susceptible’:
src/predictor/staph/antibiotics.c:1511: warning: unused variable ‘I’
src/predictor/staph/antibiotics.c: In function ‘is_methicillin_susceptible’:
src/predictor/staph/antibiotics.c:1659: warning: unused variable ‘I’

That I is declared but never used, but I guess I should not fix in C, comes from code-gen?

PS this I_permenant should be I_permanent

Yes, this comes from the code gen. The problem is that I do use it so I'm not sure why it complains.

Code looks like this:

  InfectionType I_permanent = Unsure;
  InfectionType I;
  InfectionType I = resistotype_gene()
  update_infection_type(&I,& I_permanent);
  return I_permenant;

The I is used to update I_permanent. Is there a way of writing this to stop the compiler from complaining?

No, there are two different variables
InfectionType I;
at different scopes.
At line 639 of staph/antibiotics.c we define one and never use it.
At line 647, inside a loop, so at different scope, we define and use another

You want me to fix, or ok for you to?

Ah - yeah. Will fix.