sort and group includes

* includes are sorted alphabetically

* their grouping and layout is the following:
  - nsxiv.h will be the first include
  - followed by any internal headers (e.g "commands.h" "config.h")
  - followed by system headers (<stdlib.h> etc)
  - followed by third party headers (X.h libwebp etc)

* also add `llvm-include-order` check to clang-tidy so that it can catch
  unsorted includes during CI.
pull/335/head
NRK 2 years ago committed by Gitea
parent 6d5a04005d
commit b162aee497

@ -1,6 +1,7 @@
# checks
clang-analyzer-*,clang-diagnostic-*,bugprone-*,performance-*,modernize-*
misc-*,readability-*,android-cloexec-*,cert-*
llvm-include-order
# silence
-misc-unused-parameters

@ -23,8 +23,8 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/inotify.h>
#include <unistd.h>
static union {
char d[4096]; /* aligned buffer */

@ -19,13 +19,13 @@
#include "nsxiv.h"
#include <stdlib.h>
#include "commands.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include "commands.h"
#include <unistd.h>
extern img_t img;
extern tns_t tns;

@ -22,22 +22,23 @@
#include "commands.h"
#include "config.h"
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <locale.h>
#include <signal.h>
#include <poll.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <time.h>
#include <sys/time.h>
#include <X11/keysym.h>
#include <unistd.h>
#include <X11/XF86keysym.h>
#include <X11/keysym.h>
#define MODMASK(mask) ((mask) & USED_MODMASK)
#define BAR_SEP " "

@ -20,8 +20,9 @@
#ifndef NSXIV_H
#define NSXIV_H
#include <stddef.h>
#include <stdbool.h>
#include <stddef.h>
#include <Imlib2.h>
#include <X11/Xlib.h>

@ -20,8 +20,8 @@
#include "nsxiv.h"
#include "version.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

@ -20,13 +20,13 @@
#include "nsxiv.h"
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
const char *progname;

@ -22,13 +22,14 @@
#include "config.h"
#include "icon/data.h"
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <unistd.h>
#include <X11/cursorfont.h>
#include <X11/Xatom.h>
#include <X11/Xresource.h>
#include <X11/cursorfont.h>
#if HAVE_LIBFONTS
#include "utf8.h"

Loading…
Cancel
Save