← Back to team overview

kicad-developers team mailing list archive

[PATCH 00/11] Portability series

 

Hi,

these are portability patches, most of them derived from MSVC diagnostics.

The MSVC standard library and compiler are a lot more picky about standards
compliance, so a lot of code that has only been tested on GCC is not
actually standards compliant.

This patch series mainly reduces our reliance on GCC specifics.

The atan2 overload resolution patch might be controversial because it
introduces a lot of ugly casts, so it may be better to introduce a helper
function or type here.

Replacing an anonymous enum by a bunch of "static const int" is mainly for
the benefit of MSVC here, I'm not enough of a language lawyer to tell
whether the inability to resolve an addition operator inside a template
function argument list is a bug in the resolver, or actually more correct
than simply decaying the enum to an int. I've included that patch because
these really are just constant integers, which the compiler is allowed to
inline the same way as an enum, so this smells like a micro-optimization.

   Simon

Simon Richter (11):
  Avoid comparing filepos with integers
  Drop some debug output
  Clarify atan2 overloads
  Avoid cast from const_iterator to iterator
  Correct import/export of KIFACE_GETTER.
  Add missing C++ stdlib headers
  Open namespace around definitions
  Use numeric_limits for NaN constant
  Use const int instead of anonymous enum type
  Avoid conflicting declaration for Pgm()
  Replace GCC-specific __func__ with portable __FUNCTION__

 common/gal/color4d.cpp                         |  4 +++-
 common/gal/graphics_abstraction_layer.cpp      |  2 ++
 common/grid_tricks.cpp                         |  2 ++
 common/selcolor.cpp                            |  2 ++
 common/tool/action_manager.cpp                 |  1 +
 common/trigo.cpp                               |  2 +-
 common/view/view.cpp                           |  2 +-
 eeschema/class_library.h                       |  2 ++
 eeschema/dialogs/dialog_lib_edit_pin_table.cpp |  2 ++
 eeschema/sch_sheet_path.h                      |  2 ++
 gerbview/class_GERBER.cpp                      |  1 +
 gerbview/gerbview_frame.cpp                    |  2 +-
 include/common.h                               |  6 ++++++
 include/geometry/rtree.h                       |  6 ++----
 include/kiway.h                                |  9 +++++++--
 include/math/vector2d.h                        |  2 +-
 include/pgm_base.h                             |  2 --
 include/tool/tool_event.h                      |  1 +
 include/tool/tool_manager.h                    |  1 +
 kicad/files-io.cpp                             |  2 +-
 kicad/kicad.cpp                                |  9 ++++++++-
 kicad/mainframe.cpp                            |  8 ++++----
 kicad/menubar.cpp                              |  6 +++---
 kicad/pgm_kicad.h                              |  3 ++-
 kicad/prjconfig.cpp                            |  8 ++++----
 pcb_calculator/transline/transline.cpp         |  1 +
 pcbnew/class_dimension.cpp                     |  2 +-
 pcbnew/class_dimension.h                       |  2 +-
 pcbnew/class_drawsegment.cpp                   |  7 ++++---
 pcbnew/class_pad_draw_functions.cpp            |  4 ++--
 pcbnew/kicad_plugin.cpp                        |  2 +-
 pcbnew/layer_widget.cpp                        |  3 +++
 pcbnew/ratsnest_data.h                         |  2 ++
 pcbnew/ratsnest_viewitem.cpp                   |  4 +++-
 pcbnew/router/pns_diff_pair.cpp                |  1 +
 pcbnew/router/pns_optimizer.cpp                |  2 ++
 pcbnew/router/pns_utils.cpp                    |  2 ++
 pcbnew/tools/conditional_menu.h                |  1 +
 pcbnew/tools/drawing_tool.cpp                  | 10 +++++-----
 pcbnew/tools/edit_points.h                     |  3 +++
 pcbnew/tools/pcbnew_control.cpp                |  4 ----
 utils/idftools/idf_common.cpp                  |  1 +
 utils/idftools/idf_helpers.cpp                 |  6 +++---
 43 files changed, 96 insertions(+), 48 deletions(-)

-- 
2.1.4


Follow ups