-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure header files and .cpp files use the codal namespace appropriately #437
Ensure header files and .cpp files use the codal namespace appropriately #437
Conversation
@@ -31,7 +31,6 @@ DEALINGS IN THE SOFTWARE. | |||
#include "CodalDevice.h" | |||
#include "ErrorNo.h" | |||
#include "NRFLowLevelTimer.h" | |||
#include "Matrix4.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as it wasn't used.
namespace MicroBitUtility | ||
typedef enum replyState_t | ||
{ | ||
typedef enum replyState_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enum is declared and only used inside this cpp file, so no need to declare it inside the MicroBitUtility
namespace, otherwise with these changes each usage in this file would have to be prepended by the namespace.
977d285
to
9f3d96e
Compare
Flag introduced in codal-core in: lancaster-university/codal-core@509086c By default the `using namespace` line would still be present, as removing it can cause some codal targets to break if they depend on the header file to set up this namespace globally. For example, the codal-microbit-v2 target had this update to fix the namespacing: lancaster-university/codal-microbit-v2#437 This patch is part of: lancaster-university/codal-microbit-v2#240
Flag introduced in codal-core in: lancaster-university/codal-core@509086c By default the `using namespace` line would still be present, as removing it can cause some codal targets to break if they depend on the header file to set up this namespace globally. For example, the codal-microbit-v2 target had this update to fix the namespacing: lancaster-university/codal-microbit-v2#437 This patch is part of: lancaster-university/codal-microbit-v2#240
Flag introduced in codal-core in: lancaster-university/codal-core@509086c By default the `using namespace` line would still be present, as removing it can cause some codal targets to break if they depend on the namespace to be set up globally. For example, the codal-microbit-v2 target had this update to fix the namespacing: lancaster-university/codal-microbit-v2#437 This patch is part of: lancaster-university/codal-microbit-v2#240
Flag introduced in codal-core in: lancaster-university/codal-core@509086c By default the `using namespace` line would still be present, as removing it can cause some codal targets to break if they depend on the namespace to be set up globally. For example, the codal-microbit-v2 target had this update to fix the namespacing: lancaster-university/codal-microbit-v2#437 This patch is part of: lancaster-university/codal-microbit-v2#240
…ely. Also update the codal-core and codal-nrf52 dependencies as they include changes on the same topic. The classes declared in the Mbed compatibility header files have not been wrapped in the codal namespace, as programmes including the mbed.h header might not expect them to be inside that namespace. This header file is not included in any of the codal-microbit-v2 or dependencies, it's mostly used by MakeCode extensions that were accessing Mbed-specific libraries in micro:bit V1.
762629c
into
lancaster-university:master
This is part of:
using namespace codal
shouldn't be used in header files #240The only thing that hasn't been added to the codal namespace are the Mbed header files, as those are only included by programmes explicitly doing
include <mbed.h>
:codal-microbit-v2/inc/compat/mbed.h
Lines 11 to 17 in 96faa85
This PR uses a new config option added to codal-core in lancaster-university/codal-nrf52@8802eb4. By default is set to
1
, so that the codal namespace is still added globally in MicroBit.h, but the user can change this config option in case they need to integrate CODAL with other frameworks and avoid clashes in the namespace.