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

constexpr and decltype parsing #125

Merged
merged 5 commits into from
Oct 11, 2023
Merged

constexpr and decltype parsing #125

merged 5 commits into from
Oct 11, 2023

Conversation

jbowler
Copy link
Contributor

@jbowler jbowler commented Oct 10, 2023

Parses constexpr (in the manner of const) and decltype (in the manner of __typeof). Adds flags for them and also for other already parsed items (mutual, auto).

Parses constexpr (in the manner of const) and decltype (in the manner of
__typeof).  Adds flags for them and also for other already parsed items
(mutual, auto).

Signed-off-by: John Bowler <jbowler@acm.org>
Copy link
Contributor

@mrbean-bremen mrbean-bremen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank! Seems to be ok, as far as I can see, though I may miss something of course. The proof of the pudding... @usiems - please have a look at this, too.

generator/parser/codemodel.h Outdated Show resolved Hide resolved
generator/parser/type_compiler.cpp Outdated Show resolved Hide resolved
generator/parser/type_compiler.h Outdated Show resolved Hide resolved
generator/parser/codemodel.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@usiems usiems left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that, if new keywords are, for our purposes, equivalent to recognized ones, one might probably as well add a #define to the pp-qt-configuration file. The embedded preprocessor should not care.

Not directly related to this commit, but because support for auto was prepared in the code:
If auto is used for return types in the Qt headers, the generator has a problem, because the parser will not automatically derive the returned type, which in turn means that the correct code can't be generated.

This should be seldom be the case in Qt though, since this would mean that a method implementation is in the header file, which would somewhat defeat the promised stable binary interface. The only valid use case would be for templated container types, which PythonQt doesn't wrap anyway. Still, something we should be aware of.

generator/parser/codemodel.h Outdated Show resolved Hide resolved
Add .vimrc to ensure that expandtabs is always done.

Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: John Bowler <jbowler@acm.org>
@jbowler
Copy link
Contributor Author

jbowler commented Oct 10, 2023

If auto is used for return types in the Qt headers, the generator has a problem, because the parser will not automatically derive the returned type, which in turn means that the correct code can't be generated.

It is used in that way in Qt6.5.3, which is why I added it. It's like decltype() or __typeof(). Typeof is ignored which means the type will be wrong. 'auto' might work if preserved. I simply don't use C++ class auto so I'm not familiar with the restrictions. decltype is likely to occur in templates (function templates maybe) which are not currently handled.

No problem until Qt6 then the function will just have to be disabled in the relevant typesystem file. I added auto mainly so I could add big warning message when it is encountered.

For function definitions.

Signed-off-by: John Bowler <jbowler@acm.org>
@mrbean-bremen mrbean-bremen merged commit 2a68f95 into MeVisLab:qt6 Oct 11, 2023
11 checks passed
@jbowler jbowler deleted the pull-request-125 branch October 13, 2023 16:51
mrbean-bremen pushed a commit to mrbean-bremen/pythonqt that referenced this pull request Oct 29, 2023
- parses constexpr (in the manner of const) and decltype (in the manner of __typeof) 
  and adds flags for them
mrbean-bremen pushed a commit that referenced this pull request Oct 29, 2023
- parses constexpr (in the manner of const) and decltype (in the manner of __typeof) 
  and adds flags for them
mrbean-bremen pushed a commit that referenced this pull request Nov 1, 2023
- parses constexpr (in the manner of const) and decltype (in the manner of __typeof) 
  and adds flags for them
mrbean-bremen pushed a commit that referenced this pull request Nov 2, 2023
- parses constexpr (in the manner of const) and decltype (in the manner of __typeof) 
  and adds flags for them
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

Successfully merging this pull request may close these issues.

3 participants