Bug 472927 - Produce warnings for unreachable code
Summary: Produce warnings for unreachable code
Status: UNCONFIRMED
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-17 05:05 EDT by Dennis Hendriks CLA
Modified: 2015-07-20 05:46 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Hendriks CLA 2015-07-17 05:05:34 EDT
Consider the following QVTo transformation:

[code]
modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";

transformation test(in in1: ecore);

main() {
    test();
}

helper test() {
    return;
    log("Unreachable statement.");
}
[/code]

The 'log' statement is unreachable. It would be nice if a warning could be produced for it.

Note that in Java, unreachable statements are errors. I propose to consider them warnings instead. Considering them errors is irritating for generated code, temporarily commented out stuff, etc.
Comment 1 Ed Willink CLA 2015-07-17 05:24:02 EDT
(In reply to Dennis Hendriks from comment #0)
> Considering them errors is irritating for generated
> code, temporarily commented out stuff, etc.

Treating previously valid code as erroneous is a backward compatibility problem too.

I recall another recent Bugzilla about errors and warnings too.

Perhaps the time has come for a JDT-like error/warning/severity configurable preference per diagnostic so that users can select whether they like new functionality.
Comment 2 Dennis Hendriks CLA 2015-07-17 08:17:16 EDT
(In reply to Ed Willink from comment #1)
> Treating previously valid code as erroneous is a backward compatibility problem too.

That's a very good point as well.

> I recall another recent Bugzilla about errors and warnings too.

Do you mean bugzilla 472482? I recently reported that, and it is about getting rid of warnings for blackbox libraries that are not resolveable in the workspace. Some people might want to see them, some don't.

> Perhaps the time has come for a JDT-like error/warning/severity configurable preference per diagnostic so that users can select whether they like new functionality.

I think that's a good solution. In fact, I suggested that in bugzilla 472482 as well.
Comment 3 Christopher Gerking CLA 2015-07-20 05:46:28 EDT
(In reply to Ed Willink from comment #1)
> I recall another recent Bugzilla about errors and warnings too.

Are you referring to the discussions on control flow analysis? See below.


(In reply to Sergey Boyko from bug 414347, comment 3)
> For the complex case (control flow analizer) I would create a separate Bug
> that will cover all related bugs (bug 414347, bug 413587, bug 255098).

+1