Fix compilation warnings caused by major and minor macros

The following warning may be generated when compiling
with gcc or clang:

In the GNU C Library, "major" is defined by <sys/sysmacros.h>.
For historical compatibility, it is currently defined by
<sys/types.h> as well, but we plan to remove this soon. To use
"major", include <sys/sysmacros.h> directly. If you did not intend
to use a system-defined macro "major", you should undefine it after
including <sys/types.h>.

They need to be undefined before being used as function names.

Change-Id: Ib6090835f89fda070162d635a594d788c74364c9
Reviewed-by: Brett Wilson <>
Commit-Queue: Brett Wilson <>
diff --git a/src/gn/version.h b/src/gn/version.h
index 7fcf81d..6df3aa6 100644
--- a/src/gn/version.h
+++ b/src/gn/version.h
@@ -8,6 +8,13 @@
 #include <optional>
 #include <string>
+#ifdef major
+#undef major
+#ifdef minor
+#undef minor
 // Represents a semantic version.
 class Version {