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

uncrustify.cfg problems #398

Open
fluca1978 opened this issue Feb 8, 2024 · 3 comments
Open

uncrustify.cfg problems #398

fluca1978 opened this issue Feb 8, 2024 · 3 comments
Labels
enhancement Improvement to an existing feature

Comments

@fluca1978
Copy link
Collaborator

Seems that the uncrustify.cfg configuration file has deprecated or not-valid options.

With a recent version of uncrustify:

$ uncrustify --version
Uncrustify_d-0.75.1_f

$ sh uncrustify.sh 
.... # a lot of messages repeated as follows
uncrustify.cfg:472: option 'sp_type_question' is deprecated; did you want to use 'sp_before_ptr_star' instead?
Option<NUM>: at uncrustify.cfg:1182: Expected number , for 'indent_shift'; got 'false'
Option<NUM>: at uncrustify.cfg:1356: Expected number , for 'indent_comma_brace'; got 'false'
Option<NUM>: at uncrustify.cfg:1360: Expected number , for 'indent_comma_paren'; got 'false'
Option<NUM>: at uncrustify.cfg:1364: Expected number , for 'indent_bool_paren'; got 'false'
Option<UNUM>: at uncrustify.cfg:2988: Expected unsigned number , for 'mod_full_brace_if_chain'; got 'false'
Option<NUM>: at uncrustify.cfg:3217: Expected number , for 'pp_indent_brace'; got 'true'

with an older version:

$ uncrustify --version
Uncrustify_d-0.72.0_f


$ sh uncrustify.sh
 ... # a lot of repreated messages as follows
uncrustify.cfg:1356: unknown option 'indent_comma_brace'
uncrustify.cfg:1541: unknown option 'nl_do_leave_one_liners'
uncrustify.cfg:1997: unknown option 'nl_before_brace_open'
uncrustify.cfg:2083: unknown option 'nl_before_ignore_after_case'
uncrustify.cfg:2281: unknown option 'nl_before_struct'
uncrustify.cfg:2696: unknown option 'align_func_proto_star_style'
uncrustify.cfg:2704: unknown option 'align_func_proto_amp_style'
uncrustify.cfg:2825: unknown option 'cmt_reflow_fold_regex_file'
uncrustify.cfg:2833: unknown option 'cmt_reflow_indent_to_paragraph_start'
uncrustify.cfg:2851: unknown option 'cmt_align_doxygen_javadoc_tags'
uncrustify.cfg:2859: unknown option 'cmt_sp_before_doxygen_javadoc_tags'


@jesperpedersen
Copy link
Collaborator

I did some related work in pgmoneta/pgmoneta@607a4a1

@jesperpedersen jesperpedersen added the enhancement Improvement to an existing feature label Feb 8, 2024
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 8, 2024
Fixes the configuration of uncrustify.

Also adds a few checks to the `uncrustify.sh` script to verify the
program is there.

Close agroal#398
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 8, 2024
Fixes the configuration of uncrustify for version 0.78.1 built from
the GitHub repository.

Also adds a few checks to the `uncrustify.sh` script to verify the
program is there.

See <pgmoneta/pgmoneta@607a4a1>

Close agroal#398
@fluca1978
Copy link
Collaborator Author

Commit 189c5f7 silents all the warnings, and works with uncrustify 0.78.
One problem I see, is that after a run of uncrustify.sh the multiline macros are changed as the diff that follows. I've not committed the changes to the macros because I'm not sure this is what we want or is a mispelled configuration in my commit. I think the macro alignment is something we should not worry too much.

$ git diff upstream/master
diff --git a/src/include/pgagroal.h b/src/include/pgagroal.h
index c4dff95..b6b2e4a 100644
--- a/src/include/pgagroal.h
+++ b/src/include/pgagroal.h
@@ -174,14 +174,14 @@ extern "C" {
 #define unlikely(x)  __builtin_expect (!!(x), 0)
 
 #define MAX(a, b)               \
-   ({ __typeof__ (a) _a = (a);  \
-      __typeof__ (b) _b = (b);  \
-      _a > _b ? _a : _b; })
+        ({ __typeof__ (a) _a = (a);  \
+           __typeof__ (b) _b = (b);  \
+           _a > _b ? _a : _b; })
 
 #define MIN(a, b)               \
-   ({ __typeof__ (a) _a = (a);  \
-      __typeof__ (b) _b = (b);  \
-      _a < _b ? _a : _b; })
+        ({ __typeof__ (a) _a = (a);  \
+           __typeof__ (b) _b = (b);  \
+           _a < _b ? _a : _b; })
 
 /*
  * Common piece of code to perform a sleeping.
@@ -194,13 +194,13 @@ extern "C" {
  *
  */
 #define SLEEP(zzz)                  \
-   do                               \
-   {                                \
-      struct timespec ts_private;   \
-      ts_private.tv_sec = 0;        \
-      ts_private.tv_nsec = zzz;     \
-      nanosleep(&ts_private, NULL); \
-   } while (0);
+        do                               \
+        {                                \
+           struct timespec ts_private;   \
+           ts_private.tv_sec = 0;        \
+           ts_private.tv_nsec = zzz;     \
+           nanosleep(&ts_private, NULL); \
+        } while (0);
 
 /*
  * Commonly used block of code to sleep
@@ -217,14 +217,14 @@ extern "C" {
        SLEEP_AND_GOTO(100000L, retry)
  */
 #define SLEEP_AND_GOTO(zzz, goto_to)    \
-   do                                   \
-   {                                    \
-      struct timespec ts_private;       \
-      ts_private.tv_sec = 0;            \
-      ts_private.tv_nsec = zzz;         \
-      nanosleep(&ts_private, NULL);     \
-      goto goto_to;                     \
-   } while (0);
+        do                                   \
+        {                                    \
+           struct timespec ts_private;       \
+           ts_private.tv_sec = 0;            \
+           ts_private.tv_nsec = zzz;         \
+           nanosleep(&ts_private, NULL);     \
+           goto goto_to;                     \
+        } while (0);
 
 /**
  * The shared memory segment

@jesperpedersen
Copy link
Collaborator

Sure, you can leave those out - I'll look at it

fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 16, 2024
Fixes the configuration of uncrustify for version 0.78.1 built from
the GitHub repository.

Also adds a few checks to the `uncrustify.sh` script to verify the
program is there.

See <pgmoneta/pgmoneta@607a4a1>

Close agroal#398
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 19, 2024
Fixes the configuration of uncrustify for version 0.78.1 built from
the GitHub repository.

Also adds a few checks to the `uncrustify.sh` script to verify the
program is there.

See <pgmoneta/pgmoneta@607a4a1>

Close agroal#398
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants