php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #71701 Misleading indentation warning
Submitted: 2016-03-02 12:13 UTC Modified: 2016-03-02 23:45 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: daniel dot nagy at mirror dot hu Assigned:
Status: Wont fix Package: Compile Warning
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: daniel dot nagy at mirror dot hu
New email:
PHP Version: OS:

 

 [2016-03-02 12:13 UTC] daniel dot nagy at mirror dot hu
Description:
------------
GCC 6 recently introduced a new compiler warning for misleading indentation in codes. It would be really great if PHP would also include this warning (maybe disabled by default?).
See more here: http://developerblog.redhat.com/2016/02/26/gcc-6-wmisleading-indentation-vs-goto-fail/

Test script:
---------------
if (some_condition())
   do_foo();
   do_bar();


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-02 23:45 UTC] requinix@php.net
-Status: Open +Status: Wont fix
 [2016-03-02 23:45 UTC] requinix@php.net
This is the kind of thing that would be best suited by a sort of code analysis tool - not baked into the PHP engine. Those kinds of tools could also detect other sorts of code "errors", such as not following some defined coding style. It's not like we're Python :D

There are a bunch out there. Find one (or more) you like, see if it supports checking indentation levels, and if not then you should suggest the feature to the maintainer.

IDEs that support PHP are worth a check too as that'd be the best place for a programmer to find out about mistakes. I personally use NetBeans and its PHP addon supports many different inline warnings ("hints") as well as a few third-party analysis tools.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC