Skip to content

Fix keywords for Objective-C and C - #1373

Merged
gmaurel merged 3 commits into
uncrustify:masterfrom
gentoo-root:bugfix/objc-keywords
Oct 16, 2017
Merged

gmaurel merged 3 commits into
uncrustify:masterfrom
gentoo-root:bugfix/objc-keywords

Conversation

@gentoo-root

Copy link
Copy Markdown
Contributor

Add missing Objective-C nullability keywords. Remove LANG_C flag from
C++-only keywords. Add Objective-C BOOL type.

@guy-maurel

Copy link
Copy Markdown
Contributor

Have a look to:
https://travis-ci.org/uncrustify/uncrustify/jobs/286963341
2 tests have not passed:

c_00453_ (Failed)
objective-c_50800 (Failed)

You can test it yourself for commiting by using the script:
./scripts/Test_more_Options.sh

@gentoo-root

Copy link
Copy Markdown
Contributor Author

Yes, thank you, I've seen it, and I'm working on it. I'll let you know when I get that fixed.

In master, there are some invalid tests that have incorrect output, but are passing, because uncrustify fails to work correctly. After my changes these tests began to fail, and I'm going to fix the tests. The objective-c_50800 test indeed caught a bug caused by my changes, and I'm going to fix my code.

@gentoo-root

Copy link
Copy Markdown
Contributor Author

Hmm, this time I don't understand the errors of the CI. I can't reproduce it on my machine, but CI fails to test debug builds showing the following message:

1: CMake Error at C:/projects/uncrustify/tests/run_test.cmake:44 (message):
1:   Uncrustify error: keywords_are_sorted: bad sort order at idx 24, words
1:   '__nullable' and '_Bool'
1: 
1:   Assertion failed: keywords_are_sorted(), file
1:   C:\projects\uncrustify\src\uncrustify.cpp, line 324
1: 
1: 

I double-checked with ASCII table, and I'm sure that _Bool should be before __nullable, so I don't understand why it complains. I've run scripts/Run_uncrustify_for_sources.sh, and it doesn't complain. Also I don't understand why it happens during testing and why it doesn't happen on my machine.

What should I do with that? :)

@CDanU

CDanU commented Oct 13, 2017 •

Copy link
Copy Markdown
Collaborator

I get the same error on my machine, the release builds are running through because they most likely ignore the assert.

_ has ASCII 95, while B has 66 so the _Bool comes before __nullable.

@gentoo-root

Copy link
Copy Markdown
Contributor Author

My bad, I have them in the correct order locally, but I forgot to push that change :(
Sorry for the extra noise.

@CDanU

CDanU commented Oct 13, 2017

Copy link
Copy Markdown
Collaborator

Ahh ok, I just noticed that my last comment wasn't all that helpful.

The commits are a bit messy. I think that you could combine commit 1 and 3. If it doesn't cause you to much trouble I would prefer to have the new keywords added and than all the formatting applied in an extra commit.

@gentoo-root

Copy link
Copy Markdown
Contributor Author

If it doesn't cause you to much trouble I would prefer to have the new keywords added and than all the formatting applied in an extra commit.

OK, no problem, I'll reorganize my commits.

Add missing Objective-C nullability keywords. Make nullable, nonnull and
null_unspecified of type CT_TYPE because they are used before parameter
types in method declarations. Handle them in properties correctly by
changing CT_TYPE to CT_OC_PROPERTY_ATTR where necessary.

Remove LANG_C flag from C++-only keywords.

Add Objective-C BOOL type.
Some of the enums in the tests are called 'not'. The output files had
that enums incorrectly formatted, because 'not' is a keyword in C++, and
uncrustify treated it as a C keyword too.

Also that enum had a syntax error, because two values weren't separated
by a comma. Fix it by putting a missing comma there.
@gentoo-root

Copy link
Copy Markdown
Contributor Author

I've reorganized the commits, and all checks still pass.

@gmaurel
gmaurel merged commit e8034be into uncrustify:master Oct 16, 2017
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.

4 participants