Skip to content
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

[BUG]Keil EC++ compiler throws warnings when compiling C++ files #35

Closed
vbrzeski opened this issue Mar 23, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@vbrzeski
Copy link

vbrzeski commented Mar 23, 2020

Describe the bug
The Keil C166 EC++ compiler throws an error for each compilation unit that includes the task.h header file. As you can imagine, this can be many files! It creates a problem where users of the framework I am providing are concerned when they see a warning for each compilation unit. I am unsure if this issue persists in other Keil toolsets, especially since there are so many official ports. Of course the users can ignore this, or I can fork the kernel, but I think that is bad practice.

Target

  • Custom Infineon XC2287M target

Host

  • Host OS: Windows 10 Latest corporate image
  • Version: 1909

To Reproduce

  • Use Keil C166 compiler
  • Compile a C++ file with the FreeRTOS headers attached

Expected behavior
You will see a warning that cannot be suppressed stating:

.\FreeRTOS\include\task.h(121): warning: class "xTASK_PARAMETERS" defines no constructor to initialize the following: const member "xTASK_PARAMETERS::pcName"

Additional context
My easy fix on line 124 of task.h in latest git commit:

/*
 * Parameters required to create an MPU protected task.
 */
typedef struct xTASK_PARAMETERS
{
	TaskFunction_t pvTaskCode;
  #ifdef __cplusplus
  const char * pcName;
	#else
  const char * const pcName;	/*lint !e971 Unqualified char types are allowed for strings and single characters only. */
  #endif
  configSTACK_DEPTH_TYPE usStackDepth;
	void *pvParameters;
	UBaseType_t uxPriority;
	StackType_t *puxStackBuffer;
	MemoryRegion_t xRegions[ portNUM_CONFIGURABLE_REGIONS ];
	#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
		StaticTask_t * const pxTaskBuffer;
	#endif
} TaskParameters_t;

I found an older post for the same issue, but on the ARM platform here

Unfortunately, I am not able to suppress this warning without globally disabling all warnings (no warning number associated). See this for details.

@vbrzeski vbrzeski added the bug Something isn't working label Mar 23, 2020
@RichardBarry
Copy link
Contributor

Will discuss internally, but it might be neater and more flexibly just to change:

const char * const pcName;

to

const char * pcName;

in all cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants