Remove multiple definitions of const
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
var |= type; \
|
var |= type; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/*! @brief Type of function definition for bit field usage */
|
/*! @brief Type of variable definition for bit field usage */
|
||||||
typedef enum _CFILE_VARIABLE_TYPE_T
|
typedef enum _CFILE_VARIABLE_TYPE_T
|
||||||
{
|
{
|
||||||
CVARIABLE_TYPE_UNDEF = 0, /*!< @brief undefined */
|
CVARIABLE_TYPE_UNDEF = 0, /*!< @brief undefined */
|
||||||
|
@@ -136,7 +136,7 @@ STATIC void createVariableSpecificCheck(FILE *aFile, cfile_variable_t *aVariable
|
|||||||
{
|
{
|
||||||
char *tempChar = NULL;
|
char *tempChar = NULL;
|
||||||
|
|
||||||
if (NULL != strstr(aVariable->dataType, STUB_DATATYPE_CONST))
|
if (NULL != strstr(aVariable->dataType, CPARS_ELEMENT_CONST))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ STATIC void createParameterSpecificCheck(FILE *aFile, cfunction_t *aFunction, cf
|
|||||||
fprintf(aFile, ", strlen("STUBINIT_PARAM_PARAMETER_S1"));"NEWLINES, aParameterIndex);
|
fprintf(aFile, ", strlen("STUBINIT_PARAM_PARAMETER_S1"));"NEWLINES, aParameterIndex);
|
||||||
fprintf(aFile, "\t}" NEWLINES);
|
fprintf(aFile, "\t}" NEWLINES);
|
||||||
// injection only for non constant and non NULL parameter
|
// injection only for non constant and non NULL parameter
|
||||||
if (NULL == strstr(aParameter->dataType, STUB_DATATYPE_CONST))
|
if (NULL == strstr(aParameter->dataType, CPARS_ELEMENT_CONST))
|
||||||
{
|
{
|
||||||
fprintf(aFile, "\telse if (NULL != " STUBINIT_PARAM_PARAMETER_S1 ")" NEWLINES "\t{" NEWLINES, aParameterIndex);
|
fprintf(aFile, "\telse if (NULL != " STUBINIT_PARAM_PARAMETER_S1 ")" NEWLINES "\t{" NEWLINES, aParameterIndex);
|
||||||
fprintf(aFile, "\t\tmemcpy(" STUBINIT_PARAM_PARAMETER_S1 ", "STUBPARAMETER_STRUCT_S1"["STUBINSTANCE_S1"]."STUBPARAMETER_PARAM_S1", " //
|
fprintf(aFile, "\t\tmemcpy(" STUBINIT_PARAM_PARAMETER_S1 ", "STUBPARAMETER_STRUCT_S1"["STUBINSTANCE_S1"]."STUBPARAMETER_PARAM_S1", " //
|
||||||
@@ -244,7 +244,7 @@ STATIC void createParameterSpecificCheck(FILE *aFile, cfunction_t *aFunction, cf
|
|||||||
fprintf(aFile, ");" NEWLINES);
|
fprintf(aFile, ");" NEWLINES);
|
||||||
fprintf(aFile, "\t}" NEWLINES);
|
fprintf(aFile, "\t}" NEWLINES);
|
||||||
// injection only for non constant and non NULL parameter
|
// injection only for non constant and non NULL parameter
|
||||||
if (NULL == strstr(aParameter->dataType, STUB_DATATYPE_CONST))
|
if (NULL == strstr(aParameter->dataType, CPARS_ELEMENT_CONST))
|
||||||
{
|
{
|
||||||
fprintf(aFile, "\telse if (NULL != " STUBINIT_PARAM_PARAMETER_S1 ")" NEWLINES "\t{" NEWLINES, aParameterIndex);
|
fprintf(aFile, "\telse if (NULL != " STUBINIT_PARAM_PARAMETER_S1 ")" NEWLINES "\t{" NEWLINES, aParameterIndex);
|
||||||
fprintf(aFile, "\t\tmemcpy(" STUBINIT_PARAM_PARAMETER_S1 ", "STUBPARAMETER_STRUCT_S1"["STUBINSTANCE_S1"]."STUBPARAMETER_PARAM_S1", " //
|
fprintf(aFile, "\t\tmemcpy(" STUBINIT_PARAM_PARAMETER_S1 ", "STUBPARAMETER_STRUCT_S1"["STUBINSTANCE_S1"]."STUBPARAMETER_PARAM_S1", " //
|
||||||
@@ -293,7 +293,7 @@ STATIC int8_t createStubExpected(char *aNoSuffix, FILE *aFile, FILE *aHeader, cf
|
|||||||
work = aList->head;
|
work = aList->head;
|
||||||
while (work)
|
while (work)
|
||||||
{
|
{
|
||||||
if (!CVARIABLE_CHECK_TYPE(work->type, CVARIABLE_TYPE_REGULAR) || NULL != strstr(work->dataType, STUB_DATATYPE_CONST))
|
if (!CVARIABLE_CHECK_TYPE(work->type, CVARIABLE_TYPE_REGULAR) || NULL != strstr(work->dataType, CPARS_ELEMENT_CONST))
|
||||||
{
|
{
|
||||||
work = work->next;
|
work = work->next;
|
||||||
continue;
|
continue;
|
||||||
@@ -491,21 +491,21 @@ STATIC int8_t createStubFunctionBlock(FILE *aFile, FILE *aHeader, cfunction_t *a
|
|||||||
(void) xmallocStrlcpy(&dataTypeTemp, parameter->dataType, strlen(parameter->dataType));
|
(void) xmallocStrlcpy(&dataTypeTemp, parameter->dataType, strlen(parameter->dataType));
|
||||||
|
|
||||||
// remove trailing "const" for pointer and leading "const" for regular variables from expected structure
|
// remove trailing "const" for pointer and leading "const" for regular variables from expected structure
|
||||||
while (NULL != (constPos = strstr(dataTypeTemp + constOffset, STUB_DATATYPE_CONST)))
|
while (NULL != (constPos = strstr(dataTypeTemp + constOffset, CPARS_ELEMENT_CONST)))
|
||||||
{
|
{
|
||||||
if (NULL == parameter->array && NULL == strstr(parameter->dataType, "*"))
|
if (NULL == parameter->array && NULL == strstr(parameter->dataType, "*"))
|
||||||
{
|
{
|
||||||
// remove all const
|
// remove all const
|
||||||
memset(constPos, ' ', strlen(STUB_DATATYPE_CONST));
|
memset(constPos, ' ', strlen(CPARS_ELEMENT_CONST));
|
||||||
}
|
}
|
||||||
else if (constPos == dataTypeTemp)
|
else if (constPos == dataTypeTemp)
|
||||||
{
|
{
|
||||||
constOffset = strlen(STUB_DATATYPE_CONST);
|
constOffset = strlen(CPARS_ELEMENT_CONST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// remove trailing const
|
// remove trailing const
|
||||||
memset(constPos, ' ', strlen(STUB_DATATYPE_CONST));
|
memset(constPos, ' ', strlen(CPARS_ELEMENT_CONST));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xStringTrim(dataTypeTemp, strlen(dataTypeTemp));
|
xStringTrim(dataTypeTemp, strlen(dataTypeTemp));
|
||||||
|
@@ -71,6 +71,5 @@
|
|||||||
#define STUB_CONSOLE_CREATE_ERROR_S2 "...stub creation failed\n"STUB_CONSOLE_FAIL " %s creation failed (%d)\n"
|
#define STUB_CONSOLE_CREATE_ERROR_S2 "...stub creation failed\n"STUB_CONSOLE_FAIL " %s creation failed (%d)\n"
|
||||||
#define STUB_CONSOLE_CREATE_OK_S1 "...stub created > %s\n"
|
#define STUB_CONSOLE_CREATE_OK_S1 "...stub created > %s\n"
|
||||||
|
|
||||||
#define STUB_DATATYPE_CONST "const"
|
|
||||||
#define STUB_REGEX_STD_DATATYPE "(^|[^_[:alnum:]])([ui]+nt[0-9]{1,2}_t|char|uchar|word[12346]{2}|int[12346]{0,2}|byte)([^_[:alnum:]]|$)"
|
#define STUB_REGEX_STD_DATATYPE "(^|[^_[:alnum:]])([ui]+nt[0-9]{1,2}_t|char|uchar|word[12346]{2}|int[12346]{0,2}|byte)([^_[:alnum:]]|$)"
|
||||||
#endif /* STUBSER_STUBSER_LOC_H_ */
|
#endif /* STUBSER_STUBSER_LOC_H_ */
|
||||||
|
Reference in New Issue
Block a user