drm_hwcomposer: Use pragma once instead of include guards
Some of existing include guards were copy-pasted without modification,
therefore have incorrect name. Switch to 'pragma once' in order to fix
it and avoid such copy-paste issues in the future.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/backend/Backend.h b/backend/Backend.h
index 82b8fca..c24e818 100644
--- a/backend/Backend.h
+++ b/backend/Backend.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_BACKEND_H
-#define ANDROID_BACKEND_H
+#pragma once
#include "hwc2_device/DrmHwcTwo.h"
@@ -41,5 +40,3 @@
int client_start, size_t client_size);
};
} // namespace android
-
-#endif
diff --git a/backend/BackendClient.h b/backend/BackendClient.h
index 95abb0f..1333eca 100644
--- a/backend/BackendClient.h
+++ b/backend/BackendClient.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_BACKEND_CLIENT_H
-#define ANDROID_BACKEND_CLIENT_H
+#pragma once
#include "Backend.h"
@@ -27,5 +26,3 @@
uint32_t *num_requests) override;
};
} // namespace android
-
-#endif
diff --git a/backend/BackendManager.h b/backend/BackendManager.h
index 751cb78..4976744 100644
--- a/backend/BackendManager.h
+++ b/backend/BackendManager.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_BACKEND_MANAGER_H
-#define ANDROID_BACKEND_MANAGER_H
+#pragma once
#include <functional>
#include <map>
@@ -54,5 +53,3 @@
std::map<std::string, BackendConstructorT> available_backends_;
};
} // namespace android
-
-#endif
diff --git a/bufferinfo/BufferInfoGetter.h b/bufferinfo/BufferInfoGetter.h
index 5591296..5131c37 100644
--- a/bufferinfo/BufferInfoGetter.h
+++ b/bufferinfo/BufferInfoGetter.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_BUFFERINFOGETTER_H_
-#define ANDROID_BUFFERINFOGETTER_H_
+#pragma once
#include <drm/drm_fourcc.h>
#include <hardware/gralloc.h>
@@ -89,4 +88,3 @@
#endif
} // namespace android
-#endif
diff --git a/bufferinfo/BufferInfoMapperMetadata.h b/bufferinfo/BufferInfoMapperMetadata.h
index ab269dc..ce66fe5 100644
--- a/bufferinfo/BufferInfoMapperMetadata.h
+++ b/bufferinfo/BufferInfoMapperMetadata.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef PLATFORMIMAGINATION_H
-#define PLATFORMIMAGINATION_H
+#pragma once
#include "bufferinfo/BufferInfoGetter.h"
@@ -32,5 +31,3 @@
static BufferInfoGetter *CreateInstance();
};
} // namespace android
-
-#endif // PLATFORMIMAGINATION_H
diff --git a/bufferinfo/legacy/BufferInfoImagination.h b/bufferinfo/legacy/BufferInfoImagination.h
index 635e3b5..3f4e13a 100644
--- a/bufferinfo/legacy/BufferInfoImagination.h
+++ b/bufferinfo/legacy/BufferInfoImagination.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef BUFFERINFOIMAGINATION_H
-#define BUFFERINFOIMAGINATION_H
+#pragma once
#include <hardware/gralloc.h>
@@ -30,5 +29,3 @@
auto GetBoInfo(buffer_handle_t handle) -> std::optional<BufferInfo> override;
};
} // namespace android
-
-#endif // PLATFORMIMAGINATION_H
diff --git a/bufferinfo/legacy/BufferInfoLibdrm.h b/bufferinfo/legacy/BufferInfoLibdrm.h
index 7f5b08c..d913d57 100644
--- a/bufferinfo/legacy/BufferInfoLibdrm.h
+++ b/bufferinfo/legacy/BufferInfoLibdrm.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef BUFFERINFOLIBDRM_H_
-#define BUFFERINFOLIBDRM_H_
+#pragma once
#include <hardware/gralloc.h>
@@ -35,5 +34,3 @@
};
} // namespace android
-
-#endif
diff --git a/bufferinfo/legacy/BufferInfoMaliHisi.h b/bufferinfo/legacy/BufferInfoMaliHisi.h
index cc37491..35c7989 100644
--- a/bufferinfo/legacy/BufferInfoMaliHisi.h
+++ b/bufferinfo/legacy/BufferInfoMaliHisi.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef BUFFERINFOMALIHISI_H_
-#define BUFFERINFOMALIHISI_H_
+#pragma once
#include <hardware/gralloc.h>
@@ -33,5 +32,3 @@
uint64_t ConvertGrallocFormatToDrmModifiers(uint64_t flags, bool is_rgb);
};
} // namespace android
-
-#endif
diff --git a/bufferinfo/legacy/BufferInfoMaliMediatek.h b/bufferinfo/legacy/BufferInfoMaliMediatek.h
index 43d987a..120a88c 100644
--- a/bufferinfo/legacy/BufferInfoMaliMediatek.h
+++ b/bufferinfo/legacy/BufferInfoMaliMediatek.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef BUFFERINFOMALIMTK_H_
-#define BUFFERINFOMALIMTK_H_
+#pragma once
#include <hardware/gralloc.h>
@@ -30,5 +29,3 @@
auto GetBoInfo(buffer_handle_t handle) -> std::optional<BufferInfo> override;
};
} // namespace android
-
-#endif
diff --git a/bufferinfo/legacy/BufferInfoMaliMeson.h b/bufferinfo/legacy/BufferInfoMaliMeson.h
index 3b6fab0..9a484d3 100644
--- a/bufferinfo/legacy/BufferInfoMaliMeson.h
+++ b/bufferinfo/legacy/BufferInfoMaliMeson.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef BUFFERINFOMALIHISI_H_
-#define BUFFERINFOMALIHISI_H_
+#pragma once
#include <hardware/gralloc.h>
@@ -32,5 +31,3 @@
uint64_t ConvertGrallocFormatToDrmModifiers(uint64_t flags);
};
} // namespace android
-
-#endif
diff --git a/bufferinfo/legacy/BufferInfoMinigbm.h b/bufferinfo/legacy/BufferInfoMinigbm.h
index 40d9926..5525110 100644
--- a/bufferinfo/legacy/BufferInfoMinigbm.h
+++ b/bufferinfo/legacy/BufferInfoMinigbm.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef BUFFERINFOMINIGBM_H_
-#define BUFFERINFOMINIGBM_H_
+#pragma once
#include <hardware/gralloc.h>
@@ -31,5 +30,3 @@
};
} // namespace android
-
-#endif
diff --git a/compositor/DrmKmsPlan.h b/compositor/DrmKmsPlan.h
index 91f636e..054cd93 100644
--- a/compositor/DrmKmsPlan.h
+++ b/compositor/DrmKmsPlan.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRM_KMS_PLAN_H_
-#define ANDROID_DRM_KMS_PLAN_H_
+#pragma once
#include <memory>
#include <vector>
@@ -41,4 +40,3 @@
};
} // namespace android
-#endif
diff --git a/drm/DrmConnector.h b/drm/DrmConnector.h
index 629b3cc..1e1a685 100644
--- a/drm/DrmConnector.h
+++ b/drm/DrmConnector.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRM_CONNECTOR_H_
-#define ANDROID_DRM_CONNECTOR_H_
+#pragma once
#include <xf86drmMode.h>
@@ -135,5 +134,3 @@
DrmProperty writeback_out_fence_;
};
} // namespace android
-
-#endif // ANDROID_DRM_PLANE_H_
diff --git a/drm/DrmCrtc.h b/drm/DrmCrtc.h
index ebf0a97..64fb56f 100644
--- a/drm/DrmCrtc.h
+++ b/drm/DrmCrtc.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRM_CRTC_H_
-#define ANDROID_DRM_CRTC_H_
+#pragma once
#include <xf86drmMode.h>
@@ -72,5 +71,3 @@
DrmProperty out_fence_ptr_property_;
};
} // namespace android
-
-#endif // ANDROID_DRM_CRTC_H_
diff --git a/drm/DrmDevice.h b/drm/DrmDevice.h
index 4cf0132..bb515e0 100644
--- a/drm/DrmDevice.h
+++ b/drm/DrmDevice.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRM_H_
-#define ANDROID_DRM_H_
+#pragma once
#include <cstdint>
#include <map>
@@ -24,7 +23,6 @@
#include "DrmConnector.h"
#include "DrmCrtc.h"
#include "DrmEncoder.h"
-#include "DrmFbImporter.h"
#include "utils/UniqueFd.h"
namespace android {
@@ -121,5 +119,3 @@
ResourceManager *const res_man_;
};
} // namespace android
-
-#endif // ANDROID_DRM_H_
diff --git a/drm/DrmDisplayPipeline.h b/drm/DrmDisplayPipeline.h
index 7ec619e..a3958e1 100644
--- a/drm/DrmDisplayPipeline.h
+++ b/drm/DrmDisplayPipeline.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRMDISPLAYPIPELINE_H_
-#define ANDROID_DRMDISPLAYPIPELINE_H_
+#pragma once
#include <memory>
#include <vector>
@@ -86,5 +85,3 @@
};
} // namespace android
-
-#endif
diff --git a/drm/DrmEncoder.h b/drm/DrmEncoder.h
index 39a695c..89e664c 100644
--- a/drm/DrmEncoder.h
+++ b/drm/DrmEncoder.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRM_ENCODER_H_
-#define ANDROID_DRM_ENCODER_H_
+#pragma once
#include <xf86drmMode.h>
@@ -65,5 +64,3 @@
const uint32_t index_in_res_array_;
};
} // namespace android
-
-#endif // ANDROID_DRM_ENCODER_H_
diff --git a/drm/DrmFbImporter.h b/drm/DrmFbImporter.h
index 9e94238..9a7c335 100644
--- a/drm/DrmFbImporter.h
+++ b/drm/DrmFbImporter.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef DRM_DRMFBIMPORTER_H_
-#define DRM_DRMFBIMPORTER_H_
+#pragma once
#include <drm/drm_fourcc.h>
#include <hardware/gralloc.h>
@@ -87,5 +86,3 @@
};
} // namespace android
-
-#endif
diff --git a/drm/DrmMode.h b/drm/DrmMode.h
index 20515f9..c6ddc63 100644
--- a/drm/DrmMode.h
+++ b/drm/DrmMode.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRM_MODE_H_
-#define ANDROID_DRM_MODE_H_
+#pragma once
#include <xf86drmMode.h>
@@ -80,5 +79,3 @@
std::string name_;
};
} // namespace android
-
-#endif // ANDROID_DRM_MODE_H_
diff --git a/drm/DrmPlane.h b/drm/DrmPlane.h
index 31f0a33..c26a3cc 100644
--- a/drm/DrmPlane.h
+++ b/drm/DrmPlane.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRM_PLANE_H_
-#define ANDROID_DRM_PLANE_H_
+#pragma once
#include <xf86drmMode.h>
@@ -100,5 +99,3 @@
std::map<LayerTransform, uint64_t> transform_enum_map_;
};
} // namespace android
-
-#endif // ANDROID_DRM_PLANE_H_
diff --git a/drm/DrmProperty.h b/drm/DrmProperty.h
index 26a7c38..5472c4e 100644
--- a/drm/DrmProperty.h
+++ b/drm/DrmProperty.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRM_PROPERTY_H_
-#define ANDROID_DRM_PROPERTY_H_
+#pragma once
#include <xf86drmMode.h>
@@ -104,5 +103,3 @@
}
} // namespace android
-
-#endif // ANDROID_DRM_PROPERTY_H_
diff --git a/drm/DrmUnique.h b/drm/DrmUnique.h
index 282528b..2be1eb9 100644
--- a/drm/DrmUnique.h
+++ b/drm/DrmUnique.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef DRM_UNIQUE_H_
-#define DRM_UNIQUE_H_
+#pragma once
#include <xf86drmMode.h>
@@ -83,5 +82,3 @@
return DrmModeResUnique(drmModeGetResources(fd),
[](drmModeRes *it) { drmModeFreeResources(it); });
}
-
-#endif
diff --git a/drm/ResourceManager.h b/drm/ResourceManager.h
index 144d00e..fb91627 100644
--- a/drm/ResourceManager.h
+++ b/drm/ResourceManager.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef RESOURCEMANAGER_H
-#define RESOURCEMANAGER_H
+#pragma once
#include <cstring>
@@ -79,5 +78,3 @@
bool initialized_{};
};
} // namespace android
-
-#endif // RESOURCEMANAGER_H
diff --git a/drm/UEventListener.h b/drm/UEventListener.h
index c8b8582..4fefdec 100644
--- a/drm/UEventListener.h
+++ b/drm/UEventListener.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_UEVENT_LISTENER_H_
-#define ANDROID_UEVENT_LISTENER_H_
+#pragma once
#include <functional>
@@ -44,5 +43,3 @@
std::function<void()> hotplug_handler_;
};
} // namespace android
-
-#endif
diff --git a/drm/VSyncWorker.h b/drm/VSyncWorker.h
index 1e6d39f..1774cc6 100644
--- a/drm/VSyncWorker.h
+++ b/drm/VSyncWorker.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_EVENT_WORKER_H_
-#define ANDROID_EVENT_WORKER_H_
+#pragma once
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
@@ -55,5 +54,3 @@
int64_t last_timestamp_ = -1;
};
} // namespace android
-
-#endif
diff --git a/hwc2_device/DrmHwcTwo.h b/hwc2_device/DrmHwcTwo.h
index 2b8a74f..29f61da 100644
--- a/hwc2_device/DrmHwcTwo.h
+++ b/hwc2_device/DrmHwcTwo.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_DRM_HWC_TWO_H_
-#define ANDROID_DRM_HWC_TWO_H_
+#pragma once
#include <hardware/hwcomposer2.h>
@@ -86,5 +85,3 @@
uint32_t last_display_handle_ = kPrimaryDisplay;
};
} // namespace android
-
-#endif
diff --git a/hwc2_device/HwcDisplay.h b/hwc2_device/HwcDisplay.h
index d79efb0..40c90a3 100644
--- a/hwc2_device/HwcDisplay.h
+++ b/hwc2_device/HwcDisplay.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_HWC2_DEVICE_HWC_DISPLAY_H
-#define ANDROID_HWC2_DEVICE_HWC_DISPLAY_H
+#pragma once
#include <hardware/hwcomposer2.h>
@@ -239,5 +238,3 @@
};
} // namespace android
-
-#endif
diff --git a/hwc2_device/HwcDisplayConfigs.h b/hwc2_device/HwcDisplayConfigs.h
index 7c173d6..639b302 100644
--- a/hwc2_device/HwcDisplayConfigs.h
+++ b/hwc2_device/HwcDisplayConfigs.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_HWC2_DEVICE_HWC_DISPLAY_CONFIGS_H
-#define ANDROID_HWC2_DEVICE_HWC_DISPLAY_CONFIGS_H
+#pragma once
#include <hardware/hwcomposer2.h>
@@ -55,5 +54,3 @@
};
} // namespace android
-
-#endif
diff --git a/hwc2_device/HwcLayer.h b/hwc2_device/HwcLayer.h
index 41b3dbb..627d5ac 100644
--- a/hwc2_device/HwcLayer.h
+++ b/hwc2_device/HwcLayer.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_HWC2_DEVICE_HWC_LAYER_H
-#define ANDROID_HWC2_DEVICE_HWC_LAYER_H
+#pragma once
#include <hardware/hwcomposer2.h>
@@ -140,5 +139,3 @@
};
} // namespace android
-
-#endif
diff --git a/utils/UniqueFd.h b/utils/UniqueFd.h
index f0855ba..f65bedc 100644
--- a/utils/UniqueFd.h
+++ b/utils/UniqueFd.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef UNIQUEFD_H_
-#define UNIQUEFD_H_
+#pragma once
#include <fcntl.h>
#include <unistd.h>
@@ -114,5 +113,3 @@
};
} // namespace android
-
-#endif
diff --git a/utils/Worker.h b/utils/Worker.h
index 74cfdc4..b524d37 100644
--- a/utils/Worker.h
+++ b/utils/Worker.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_WORKER_H_
-#define ANDROID_WORKER_H_
+#pragma once
#include <condition_variable>
#include <cstdint>
@@ -78,4 +77,3 @@
bool initialized_;
};
} // namespace android
-#endif
diff --git a/utils/log.h b/utils/log.h
index a48d2e7..22200df 100644
--- a/utils/log.h
+++ b/utils/log.h
@@ -1,5 +1,20 @@
-#ifndef UTILS_LOG_H_
-#define UTILS_LOG_H_
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
#ifdef ANDROID
@@ -22,5 +37,3 @@
#define ALOGV(args...) printf("VERBOSE: " args)
#endif
-
-#endif
\ No newline at end of file
diff --git a/utils/properties.h b/utils/properties.h
index 0b49c61..e400236 100644
--- a/utils/properties.h
+++ b/utils/properties.h
@@ -1,5 +1,20 @@
-#ifndef UTILS_PROPERTIES_H_
-#define UTILS_PROPERTIES_H_
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
#ifdef ANDROID
@@ -25,5 +40,3 @@
}
#endif
-
-#endif
\ No newline at end of file