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

Extension Suggestion: Strings without quotation marks (Macro-like) #130

Open
tito97sp opened this issue Jun 9, 2023 · 0 comments
Open

Comments

@tito97sp
Copy link

tito97sp commented Jun 9, 2023

Title: Proposal to Enhance C Preprocessor Redefinition Strings Generation

Objective:

This proposal suggests an extension to enhance the functionality of generating C Preprocessor redefinition strings without quotation marks in order to provide more flexibility and convenience in defining C macros.

Rationale:

In certain scenarios, it becomes necessary for a module to redefine a C Preprocessor Macro to another symbol. However, the current implementation in kconfiglib utilizes the string type, which always generates a string with quotation marks. This limitation restricts the flexibility and usability of the tool.

Current Status:

The current version of kconfiglib only supports generating C Preprocessor redefinition strings with quotation marks. For instance:

#define CONFIG_FUNCTION_CALLBACK_NAME "MyFunctionCallback"

Proposed Solution:

Modify the kconfig for supporting another type (example: macro type):

config CONFIG_FUNCTION_CALLBACK_NAME
    macro "Set the name of the callback function"
    default "MyFunctionCallback"
    help
      This will generate the preprocessor macro for the function callback name.

The proposed extension aims to introduce the capability to generate C Preprocessor redefinition strings without quotation marks, as demonstrated in the following example:

#define CONFIG_FUNCTION_CALLBACK_NAME MyFunctionCallback

This enhancement will enable developers to define macros more conveniently and provide greater flexibility in their code implementations. For example:


void CONFIG_FUNCTION_CALLBACK_NAME(void)
{
   ....
}

Benefits:

  • Improved Capability: The proposed extension enhances the tool's functionality by enabling the generation of C definitions without quotation marks, allowing for more versatile macro definitions.
@tito97sp tito97sp changed the title Extension: Strings without quotation marks Extension Suggestion: Strings without quotation marks (Macro-like) Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant