Compilier doesn't report un-used variables

Beta Testing discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
Megahurts
Posts: 900
Joined: 01 Oct 2009 22:48
Location: Rocky Mountains, USA.

Compilier doesn't report un-used variables

#1 Post by Megahurts » 08 Sep 2010 09:59

I've noticed the compiler does not report un-used but declared variables like it used to.

The only ones it has reported in the message window now are ones defined in a 'sub procedure's' label declaration that never gets actually used.

Is this by design, or a bug?

Thanks again for your attention, Mhz.

(MikroBasic Pro V4.0 Beta)
HW: easyPIC5|PICFlash2|easyBT|smartGSM|easyGSM|PICPLC16|mmWorkStation|FT800 Eve|PIC Clicker/2|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|

SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|

Kalain
Posts: 1093
Joined: 11 Mar 2005 18:26
Location: Aubenas, France

Re: Compilier doesn't report un-used variables

#2 Post by Kalain » 08 Sep 2010 22:13

Yes, this has already been reported or asked but answer was : Compiler remove automatically unused variables.

Yes, I know, this is not enough, because if you want to clean your code from unused variable you need to know which one are not used.

It's quite a shame because old MB version did that.
Alain

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: Compilier doesn't report un-used variables

#3 Post by ranko.rankovic » 13 Sep 2010 14:04

Hello Megahurts and Kalain,

I was adding some variables that are not used in program it self, and compiler did remove them. Can you please create a little project that will demonstrate not removed variables?

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

Kalain
Posts: 1093
Joined: 11 Mar 2005 18:26
Location: Aubenas, France

Re: Compilier doesn't report un-used variables

#4 Post by Kalain » 13 Sep 2010 14:24

ranko.rankovic wrote:Hello Megahurts and Kalain,

I was adding some variables that are not used in program it self, and compiler did remove them. Can you please create a little project that will demonstrate not removed variables?

Best regards
The problem is not from compiler which I assume remove un used variables at compilation.
Even if this variable is removed from comilation, this (un used) variable is still there in program declaration.
So, if compiler do not display or report unused variable, it's not easy for user to remove such variables among let's say 50 variables and few thousands of code of lines.

This report is usefull when you want to clean code from a program you started long time ago from an messy idea.
Alain

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: Compilier doesn't report un-used variables

#5 Post by ranko.rankovic » 14 Sep 2010 10:12

Hello Kalain,

Thanks for pointing this out. Will proceed to our developers to implement this option in our compilers.

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

Kalain
Posts: 1093
Joined: 11 Mar 2005 18:26
Location: Aubenas, France

Re: Compilier doesn't report un-used variables

#6 Post by Kalain » 14 Sep 2010 12:23

ranko.rankovic wrote:Hello Kalain,

Thanks for pointing this out. Will proceed to our developers to implement this option in our compilers.
This feature was implemented in previous MB compiler. (May be a bit before 2.50)

User could choose to report or not this feature in Message windows.

A bit like shown below.
Capture14-09-10-13.19.11.jpg
Capture14-09-10-13.19.11.jpg (18.37 KiB) Viewed 7800 times
Alain

Megahurts
Posts: 900
Joined: 01 Oct 2009 22:48
Location: Rocky Mountains, USA.

Re: Compilier doesn't report un-used variables

#7 Post by Megahurts » 24 Sep 2010 01:59

Hey Kalain,

You're exactly right, I forgot about that feature totally! Would love to have it back again.
So I second the motion. lol

My current project is over 26K Bytes of ROM used and around 6K lines of BASIC code and I keep running my laser printer out of toner trying to keep the "top of the programs" periodic changes current for referencing to while digging a hole out through the bottom of my monitor it seems, lmho, because I expect to hit 40k - 50K when done. (I hope :roll: )
Mhz.
HW: easyPIC5|PICFlash2|easyBT|smartGSM|easyGSM|PICPLC16|mmWorkStation|FT800 Eve|PIC Clicker/2|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|

SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

Re: Compilier doesn't report un-used variables

#8 Post by LGR » 28 May 2012 01:12

Bump. Still missing this feature. I'm working on a program for PIC32 with about 2600 lines of Pascal and 45k of flash, and I would really like to clear all the dead branches out. It's not that I'm concerned about the space used, it's just that I'd like to get the schmutz out of the listing.
If you know what you're doing, you're not learning anything.

Kalain
Posts: 1093
Joined: 11 Mar 2005 18:26
Location: Aubenas, France

Re: Compilier doesn't report un-used variables

#9 Post by Kalain » 28 May 2012 05:48

LGR wrote:Bump. Still missing this feature. I'm working on a program for PIC32 with about 2600 lines of Pascal and 45k of flash, and I would really like to clear all the dead branches out. It's not that I'm concerned about the space used, it's just that I'd like to get the schmutz out of the listing.
Yep, I agree.
From what I have suggested (more than one year ago), I would like to extend the request at : "Non used code" instead of just "Non used Variables".

In my hobby project (over 7000 lines), as I do not work on it every weeks, after a year I do not remember which variables or even procedures are really used or not in my code.

Would be nice to point this after a compilation in order to clean the "schmutz". :wink:
Alain

Kalain
Posts: 1093
Joined: 11 Mar 2005 18:26
Location: Aubenas, France

Re: Compilier doesn't report un-used variables

#10 Post by Kalain » 28 May 2012 05:49

LGR wrote:Bump. Still missing this feature. I'm working on a program for PIC32 with about 2600 lines of Pascal and 45k of flash, and I would really like to clear all the dead branches out. It's not that I'm concerned about the space used, it's just that I'd like to get the schmutz out of the listing.
Yep, I agree.
From what has been suggested (more than one year ago), I would like to extend the request at : "Non used code" instead of just "Non used Variables".

In my hobby project (over 7000 lines), as I do not work on it every weeks, after a year I do not remember which variables or even procedures are really used or not in my code.

Would be nice to point this after a compilation in order to clean the "schmutz". :wink:
Alain

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

Re: Compilier doesn't report un-used variables

#11 Post by LGR » 28 May 2012 21:38

Agreed. Constants, variables, procedures. Either list the unused ones, or have an option to automatically delete them. Call it the "schmutz" tool.

=====================

That's one of a number of Yiddish words that's become incorporated into American English. It fits perfectly. :mrgreen:
If you know what you're doing, you're not learning anything.

Megahurts
Posts: 900
Joined: 01 Oct 2009 22:48
Location: Rocky Mountains, USA.

Re: Compilier doesn't report un-used variables

#12 Post by Megahurts » 30 Jun 2012 21:05

I'd like to re-enforce the request for this feature to be implemented again please mE guys.

What will it take to get it done? A majority vote? :lol:

Seriously, anybody who has done any fairly large programs can see how useful a tool like this would be,
you guys had to also, as it was in the early versions. Why drop it?

I'm sure any name you put on it will be acceptable also :wink:

Regards, Mhz.
HW: easyPIC5|PICFlash2|easyBT|smartGSM|easyGSM|PICPLC16|mmWorkStation|FT800 Eve|PIC Clicker/2|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|

SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Compilier doesn't report un-used variables

#13 Post by filip » 03 Jul 2012 08:46

Hi,

I have notified our developers regarding this, and they have it on their mind. ;)

Regards,
Filip.

Post Reply

Return to “mikroBasic PRO for PIC Beta Testing”