aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/coopgammad.c39
-rw-r--r--src/filter.c6
-rw-r--r--src/filter.h10
-rw-r--r--src/message.c13
-rw-r--r--src/message.h5
-rw-r--r--src/output.c13
-rw-r--r--src/output.h10
-rw-r--r--src/ring.c13
-rw-r--r--src/server.c36
-rw-r--r--src/util.c2
10 files changed, 131 insertions, 16 deletions
diff --git a/src/coopgammad.c b/src/coopgammad.c
index 58f0165..a4ed5a7 100644
--- a/src/coopgammad.c
+++ b/src/coopgammad.c
@@ -45,6 +45,24 @@
+extern char* argv0;
+extern char* argv0_real;
+extern struct output* outputs;
+extern size_t outputs_n;
+extern int socketfd;
+extern char* pidpath;
+extern char* socketpath;
+extern int gerror;
+extern int method;
+extern char* sitename;
+extern libgamma_site_state_t site;
+extern libgamma_partition_state_t* partitions;
+extern libgamma_crtc_state_t* crtcs;
+extern volatile sig_atomic_t reexec;
+extern volatile sig_atomic_t terminate;
+
+
+
/**
* The name of the process
*/
@@ -908,6 +926,13 @@ static void destroy(int full)
}
+
+#if defined(__clang__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wcast-align"
+#endif
+
+
/**
* Marshal the state of the process
*
@@ -1056,6 +1081,12 @@ static size_t unmarshal(void* buf)
}
+#if defined(__clang__)
+# pragma GCC diagnostic pop
+#endif
+
+
+
/**
* Unmarshal the state of the process and merge with new state
*
@@ -1231,6 +1262,9 @@ static int print_method_and_site(int query)
/**
* Print usage information and exit
*/
+#if defined(__GNU__) || defined(__clang__)
+__attribute__((noreturn))
+#endif
static void usage(void)
{
printf("Usage: %s [-m method] [-s site] [-fkpq]\n", argv0);
@@ -1238,6 +1272,11 @@ static void usage(void)
}
+#if defined(__clang__)
+# pragma GCC diagnostic ignored "-Wdocumentation-unknown-command"
+#endif
+
+
/**
* Must not be started without stdin, stdout, or stderr (may be /dev/null)
*
diff --git a/src/filter.c b/src/filter.c
index fd4efc5..943401e 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -36,6 +36,12 @@ void filter_destroy(struct filter* this)
}
+
+#if defined(__clang__)
+# pragma GCC diagnostic ignored "-Wcast-align"
+#endif
+
+
/**
* Marshal a filter
*
diff --git a/src/filter.h b/src/filter.h
index 742ade8..385ec56 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -60,6 +60,11 @@ struct filter
int client;
/**
+ * The lifespan of the filter
+ */
+ enum lifespan lifespan;
+
+ /**
* The priority of the filter
*/
int64_t priority;
@@ -70,11 +75,6 @@ struct filter
char* class;
/**
- * The lifespan of the filter
- */
- enum lifespan lifespan;
-
- /**
* The gamma ramp adjustments for the filter.
* This is raw binary data. `NULL` iff
* `lifespan == LIFESPAN_REMOVE`.
diff --git a/src/message.c b/src/message.c
index 6a5ad90..619ae25 100644
--- a/src/message.c
+++ b/src/message.c
@@ -69,6 +69,13 @@ void message_destroy(struct message* this)
}
+
+#if defined(__clang__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wcast-align"
+#endif
+
+
/**
* Marshal a message for state serialisation
*
@@ -216,6 +223,12 @@ size_t message_unmarshal(struct message* this, const void* buf)
}
+#if defined(__clang__)
+# pragma GCC diagnostic pop
+#endif
+
+
+
/**
* Extend the header list's allocation
*
diff --git a/src/message.h b/src/message.h
index 24afec1..d6447f1 100644
--- a/src/message.h
+++ b/src/message.h
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stddef.h>
+#include <limits.h>
@@ -73,6 +74,10 @@ struct message
* 0 while reading headers, 1 while reading payload, and 2 when done (internal data)
*/
int stage;
+
+#if INT_MAX != LONG_MAX
+ int padding__;
+#endif
};
diff --git a/src/output.c b/src/output.c
index 9e0ce43..264ad9b 100644
--- a/src/output.c
+++ b/src/output.c
@@ -90,6 +90,13 @@ void output_destroy(struct output* this)
}
+
+#if defined(__clang__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wcast-align"
+#endif
+
+
/**
* Marshal an output
*
@@ -219,6 +226,12 @@ size_t output_unmarshal(struct output* this, const void* buf)
}
+#if defined(__clang__)
+# pragma GCC diagnostic pop
+#endif
+
+
+
/**
* Compare to outputs by the names of their respective CRTC:s
*
diff --git a/src/output.h b/src/output.h
index e925914..ef4172b 100644
--- a/src/output.h
+++ b/src/output.h
@@ -56,6 +56,11 @@ struct output
signed depth;
/**
+ * Whether gamma ramps are supported
+ */
+ enum libgamma_decision supported;
+
+ /**
* The number of stops in the red gamma ramp
*/
size_t red_size;
@@ -77,11 +82,6 @@ struct output
size_t ramps_size;
/**
- * Whether gamma ramps are supported
- */
- enum libgamma_decision supported;
-
- /**
* The name of the output, will be its EDID
* if available, otherwise it will be the
* index of the partition, followed by a dot
diff --git a/src/ring.c b/src/ring.c
index 00ea90f..5bb9cd2 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -47,6 +47,13 @@ void ring_destroy(struct ring* this)
}
+
+#if defined(__clang__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wcast-align"
+#endif
+
+
/**
* Marshal a ring buffer
*
@@ -103,6 +110,12 @@ size_t ring_unmarshal(struct ring* this, const void* buf)
}
+#if defined(__clang__)
+# pragma GCC diagnostic pop
+#endif
+
+
+
/**
* Append data to a ring buffer
*
diff --git a/src/server.c b/src/server.c
index 448e6cc..890c5a4 100644
--- a/src/server.c
+++ b/src/server.c
@@ -31,6 +31,12 @@
+#if defined(__clang__)
+# pragma GCC diagnostic ignored "-Wswitch-enum"
+#endif
+
+
+
/**
* List of all client's file descriptors
*
@@ -148,6 +154,13 @@ void server_destroy(int disconnect)
}
+
+#if defined(__clang__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wcast-align"
+#endif
+
+
/**
* Marshal the state of the connections
*
@@ -231,6 +244,12 @@ size_t server_unmarshal(const void* buf)
}
+#if defined(__clang__)
+# pragma GCC diagnostic pop
+#endif
+
+
+
/**
* Sets the file descriptor set that includes
* the server socket and all connections
@@ -330,7 +349,7 @@ static int handle_server(void)
* Handle a closed connection
*
* @param client The file descriptor for the client
- * @retunr Zero on success, -1 on error
+ * @return Zero on success, -1 on error
*/
static int connection_closed(int client)
{
@@ -564,7 +583,7 @@ static int enumerate_crtcs(size_t conn, char* message_id)
n += strlen(outputs[i].name) + 1;
MAKE_MESSAGE(&buf, &n, 0,
- "Command: crtc-enumeration%s\n"
+ "Command: crtc-enumeration\n"
"In response to: %s\n"
"Length: %zu\n"
"\n",
@@ -616,9 +635,9 @@ static int get_gamma_info(size_t conn, char* message_id, char* crtc)
switch (output->supported)
{
- case LIBGAMMA_YES: supported = "yes"; break;
- case LIBGAMMA_NO: supported = "no"; break;
- default: supported = "maybe"; break;
+ case LIBGAMMA_YES: supported = "yes"; break;
+ case LIBGAMMA_NO: supported = "no"; break;
+ default: supported = "maybe"; break;
}
MAKE_MESSAGE(&buf, &n, 0,
@@ -747,7 +766,14 @@ static int get_gamma(size_t conn, char* message_id, char* crtc, char* coalesce,
else
for (i = start; i < end; i++)
{
+#if defined(__clang__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wcast-align"
+#endif
*(int64_t*)(buf + n) = output->table_filters[i].priority;
+#if defined(__clang__)
+# pragma GCC diagnostic pop
+#endif
n += sizeof(int64_t);
len = strlen(output->table_filters[i].class) + 1;
memcpy(buf + n, output->table_filters[i].class, len);
diff --git a/src/util.c b/src/util.c
index 1bcbe45..cb04154 100644
--- a/src/util.c
+++ b/src/util.c
@@ -200,7 +200,7 @@ int verify_utf8(const char* string, int allow_modified_nul)
{
static long BYTES_TO_MIN_BITS[] = {0, 0, 8, 12, 17, 22, 37};
static long BYTES_TO_MAX_BITS[] = {0, 7, 11, 16, 21, 26, 31};
- long bytes = 0, read_bytes = 0, bits = 0, c, character;
+ long bytes = 0, read_bytes = 0, bits = 0, c, character = 0;
/* min bits max bits
0....... 0 7