qt5base-lts/qmake/library
Orgad Shaneh 601ab660af Remove braces for single lines of conditions
#!/usr/bin/env ruby

Dir.glob('**/*.cpp') { |file|
  # skip ast (excluding paste, astpath, and canv'ast'imer)
  next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
  s = File.read(file)
  next if s.include?('qlalr')
  orig = s.dup
  s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
    res = $&
    if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
      res
    else
      res.gsub!('} else', 'else')
      res.gsub!(/\n +} *\n/m, "\n")
      res.gsub(/ *{$/, '')
    end
  }
  s.gsub!(/ *$/, '')
  File.open(file, 'wb').write(s) if s != orig
}

Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
(cherry picked from qtcreator/29a93998df8405e8799ad23934a56cd99fb36403)
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2013-02-06 14:21:44 +01:00
..
ioutils.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
ioutils.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
proitems.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
proitems.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qmake_global.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qmakebuiltins.cpp Remove braces for single lines of conditions 2013-02-06 14:21:44 +01:00
qmakeevaluator_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qmakeevaluator.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qmakeevaluator.h support alternative and multiple suffixes in $$resolve_depends() 2013-02-04 15:10:19 +01:00
qmakeglobals.cpp Remove braces for single lines of conditions 2013-02-06 14:21:44 +01:00
qmakeglobals.h don't flush qmake command line twice 2013-02-01 17:38:29 +01:00
qmakeparser.cpp Remove braces for single lines of conditions 2013-02-06 14:21:44 +01:00
qmakeparser.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00