Skip to content

Commit

Permalink
Use #pragma message() to print out warnings in MSVC (ros#114)
Browse files Browse the repository at this point in the history
* avoid #warning on MSVC build.

* limit #pragma message() usage to msvc (ms-iot/class_loader#10)

* add deprecation warnings for older header files (ms-iot/class_loader#12)
  • Loading branch information
kejxu authored and nuclearsandwich committed Jan 31, 2019
1 parent 3fc7611 commit 6a2dee1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/class_loader/class_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
#ifndef CLASS_LOADER__CLASS_LOADER_H_
#define CLASS_LOADER__CLASS_LOADER_H_

#ifdef _MSC_VER
#pragma message("Including header <class_loader/class_loader.h> is deprecated,")
#pragma message("include <class_loader/class_loader.hpp> instead.")
#else
// *INDENT-OFF* (prevent uncrustify from adding indention below)
#warning Including header <class_loader/class_loader.h> is deprecated, \
include <class_loader/class_loader.hpp> instead.
#endif

#include "./class_loader.hpp"

Expand Down
5 changes: 5 additions & 0 deletions include/class_loader/class_loader_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
#ifndef CLASS_LOADER__CLASS_LOADER_CORE_H_
#define CLASS_LOADER__CLASS_LOADER_CORE_H_

#ifdef _MSC_VER
#pragma message("Including header <class_loader/class_loader_core.h> is deprecated,")
#pragma message("include <class_loader/class_loader_core.h> instead.")
#else
// *INDENT-OFF* (prevent uncrustify from adding indention below)
#warning Including header <class_loader/class_loader_core.h> is deprecated, \
include <class_loader/class_loader_core.hpp> instead.
#endif

#include "./class_loader_core.hpp"

Expand Down
5 changes: 5 additions & 0 deletions include/class_loader/class_loader_exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
#ifndef CLASS_LOADER__CLASS_LOADER_EXCEPTIONS_H_
#define CLASS_LOADER__CLASS_LOADER_EXCEPTIONS_H_

#ifdef _MSC_VER
#pragma message("Including header <class_loader/class_loader_exceptions.h> is deprecated,")
#pragma message("include <class_loader/class_loader_exceptions.h> instead.")
#else
// *INDENT-OFF* (prevent uncrustify from adding indention below)
#warning Including header <class_loader/class_loader_exceptions.h> is deprecated, \
include <class_loader/exceptions.hpp> instead.
#endif

#include "./exceptions.hpp"

Expand Down
5 changes: 5 additions & 0 deletions include/class_loader/class_loader_register_macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
#ifndef CLASS_LOADER__CLASS_LOADER_REGISTER_MACRO_H_
#define CLASS_LOADER__CLASS_LOADER_REGISTER_MACRO_H_

#ifdef _MSC_VER
#pragma message("Including header <class_loader/class_loader_register_macro.h> is deprecated,")
#pragma message("include <class_loader/class_loader_register_macro.h> instead.")
#else
// *INDENT-OFF* (prevent uncrustify from adding indention below)
#warning Including header <class_loader/class_loader_register_macro.h> is deprecated, \
include <class_loader/register_macro.hpp> instead.
#endif

#include "./register_macro.hpp"

Expand Down
5 changes: 5 additions & 0 deletions include/class_loader/meta_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
#ifndef CLASS_LOADER__META_OBJECT_H_
#define CLASS_LOADER__META_OBJECT_H_

#ifdef _MSC_VER
#pragma message("Including header <class_loader/meta_object.h> is deprecated,")
#pragma message("include <class_loader/meta_object.h> instead.")
#else
// *INDENT-OFF* (prevent uncrustify from adding indention below)
#warning Including header <class_loader/meta_object.h> is deprecated, \
include <class_loader/meta_object.hpp> instead.
#endif

#include "./meta_object.hpp"

Expand Down
5 changes: 5 additions & 0 deletions include/class_loader/multi_library_class_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
#ifndef CLASS_LOADER__MULTI_LIBRARY_CLASS_LOADER_H_
#define CLASS_LOADER__MULTI_LIBRARY_CLASS_LOADER_H_

#ifdef _MSC_VER
#pragma message("Including header <class_loader/multi_library_class_loader.h> is deprecated,")
#pragma message("include <class_loader/multi_library_class_loader.h> instead.")
#else
// *INDENT-OFF* (prevent uncrustify from adding indention below)
#warning Including header <class_loader/multi_library_class_loader.h> is deprecated, \
include <class_loader/multi_library_class_loader.hpp> instead.
#endif

#include "./multi_library_class_loader.hpp"

Expand Down

0 comments on commit 6a2dee1

Please sign in to comment.