Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#1383 closed Bug (No Bug)

AU3Check: false warning.

Reported by: anonymous Owned by: Jos
Milestone: Component: Au3Check
Version: 3.3.2.0 Severity: None
Keywords: AU3Check declared Cc:

Description

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Au3Check_Stop_OnWarning=y
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Global $var1
$var1 = 0
Func fun()
	Local $var2
	$var2 = 0
EndFunc
fun()

;~ (?) WARNING: $var2: declared, but not used in func.

;~ >"C:\...\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\...\_TEST_2.au3" /autoit3dir "C:\...\AutoIt3" /UserParams
;~ +>19:57:35 Starting AutoIt3Wrapper v.2.0.0.3    Environment(Language:0409  Keyboard:00000409  OS:WIN_XP/Service Pack 3  CPU:X86 OS:X86)
;~ >Running AU3Check (1.54.19.0)  params:-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6  from:C:\...\AutoIt3
;~ C:\...\_TEST_2.au3(9,13) : WARNING: $var2: declared, but not used in func.
;~ 	Local $var2
;~ 	~~~~~~~~~~~^
;~ C:\...\_TEST_2.au3 - 0 error(s), 1 warning(s)
;~ ->19:57:35 AU3Check ended.rc:1
;~ +>19:57:37 AutoIt3Wrapper Finished
;~ >Exit code: 0    Time: 2.215

Attachments (0)

Change History (5)

comment:1 Changed 10 years ago by Valik

  • Resolution set to No Bug
  • Status changed from new to closed

The warning is correct. The variable is never used and there are no side effects to either assignment statement. You can remove the variable and the code will behave exactly the same.

comment:2 Changed 10 years ago by anonymous

Ok, I think I see the logic of it.
In that case I should put in a additional question mark.
(?) no warning for $var1.

comment:3 Changed 10 years ago by anonymous

nevermind.
-w 5 : local var declared but not used (off)

comment:4 Changed 10 years ago by Valik

Au3Check makes no determination between non-Const and Const when it does its check for usage. Thus if it were to test Global variables you would get several hundred warnings for files with a lot of Global Const variables. Local variables (Const or not) can safely be tested for use because there aren't going to be hundreds of unused constants at function scope.

comment:5 Changed 10 years ago by anonymous

Clear. Thanks for additional doc.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jos.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.