Fix variable shadowing 26/261026/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 8 Jul 2021 11:51:11 +0000 (20:51 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 8 Jul 2021 11:51:11 +0000 (20:51 +0900)
Change-Id: Id3f1b2d739046bf7f274ca2aad87b3d855b7377e
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
CMakeLists.txt
src/unified/unified_backend.cc
test/smoke_test/dependency_checker_test.cc
test/smoke_test/smoke_test_helper.cc
test/unit_tests/test_unified_installer_factory.cc

index 1a860c1..b716af1 100644 (file)
@@ -11,7 +11,7 @@ IF(NOT CMAKE_BUILD_TYPE)
 ENDIF(NOT CMAKE_BUILD_TYPE)
 
 # Compiler flags
-SET(EXTRA_FLAGS "-Wall -Wextra")
+SET(EXTRA_FLAGS "-Wall -Wextra -Werror=shadow")
 SET(CMAKE_C_FLAGS_PROFILING    "-O2 ${EXTRA_FLAGS}")
 SET(CMAKE_CXX_FLAGS_PROFILING  "-O2 -std=c++14 ${EXTRA_FLAGS}")
 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g ${EXTRA_FLAGS}")
index 3c4bb44..14ecacc 100644 (file)
@@ -11,9 +11,9 @@
 namespace ci = common_installer;
 
 int main(int argc, char** argv) {
-  ci::PkgmgrInstaller pkgmgr_installer;
+  ci::PkgmgrInstaller installer;
   try {
-    auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer);
+    auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &installer);
 
     ci::InstallerRunner runner(
         std::make_unique<ci::UnifiedInstallerFactory>(), pkgmgr);
index 3b1c9d7..2a2bb3b 100644 (file)
@@ -156,9 +156,9 @@ class DependencyCheckerTest : public testing::Test {
   virtual void TearDown() {
     BackendInterface::SmokeInstallerFactoryPtr factory(
         new UnifiedSmokeInstallerFactory());
-    UnifiedBackendInterface backend(
+    UnifiedBackendInterface unified_backend(
         std::move(factory), std::to_string(params.test_user.uid));
-    UninstallAllSmokeApps(env->request_mode_, params.test_user.uid, &backend);
+    UninstallAllSmokeApps(env->request_mode_, params.test_user.uid, &unified_backend);
   }
 
  protected:
index ba595af..2c0e047 100644 (file)
@@ -103,11 +103,11 @@ int main(int argc, char** argv) {
     LOG(DEBUG) << "Remove parser plugins steps";
   }
 
-  ci::PkgmgrInstaller pkgmgr_installer;
+  ci::PkgmgrInstaller installer;
   try {
     ci::AppInstaller::Result result;
     auto pkgmgr = ci::PkgMgrInterface::Create(
-        backend_argc, argv, &pkgmgr_installer);
+        backend_argc, argv, &installer);
 
     if (remove_plugins) {
       ci::InstallerRunner runner(
index 2e59c1d..d7b9d72 100644 (file)
@@ -90,7 +90,7 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_GetPkgTypeFromPkgID) {
             reinterpret_cast<const char*>(arg.data())));
   argv.push_back(nullptr);
 
-  TestPkgmgrInstaller pkgmgr_installer;
+  TestPkgmgrInstaller installer;
   EXPECT_CALL(GetMock<GumMock>(),
       gum_user_get_sync(_, _)).
           WillRepeatedly(Invoke(__gum_user_get_sync_fake));
@@ -98,7 +98,7 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_GetPkgTypeFromPkgID) {
   auto pkgmgr = common_installer::PkgMgrInterface::Create(
       argv.size() - 1,
       argv.data(),
-      &pkgmgr_installer,
+      &installer,
       nullptr);
   if (!pkgmgr) {
     ASSERT_TRUE(false);
@@ -141,10 +141,10 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_GetPkgTypeFromPkgID) {
   EXPECT_EQ(pkgmgr->GetRequestInfoCount(), 2);
 
   for (int idx = 0; idx < 2; idx++) {
-    std::unique_ptr<common_installer::AppInstaller> installer =
+    std::unique_ptr<common_installer::AppInstaller> app_installer =
         factory->CreateInstaller(pkgmgr, idx);
     // TODO(jungh.yeon): Need to add ways about validating instance.
-    EXPECT_NE(installer, nullptr);
+    EXPECT_NE(app_installer, nullptr);
   }
 }
 
@@ -179,7 +179,7 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_GetPkgTypeFromFilename) {
                       reinterpret_cast<pkgmgrinfo_pkginfo_h>(handle2)),
                   Return(PMINFO_R_OK)));
 
-  TestPkgmgrInstaller pkgmgr_installer;
+  TestPkgmgrInstaller installer;
   EXPECT_CALL(GetMock<GumMock>(),
       gum_user_get_sync(_, _)).
           WillRepeatedly(Invoke(__gum_user_get_sync_fake));
@@ -187,7 +187,7 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_GetPkgTypeFromFilename) {
   auto pkgmgr = common_installer::PkgMgrInterface::Create(
       argv.size() - 1,
       argv.data(),
-      &pkgmgr_installer,
+      &installer,
       nullptr);
   if (!pkgmgr) {
     ASSERT_TRUE(false);
@@ -199,9 +199,9 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_GetPkgTypeFromFilename) {
       new common_installer::UnifiedInstallerFactory());
 
   for (int idx = 0; idx < 2; idx++) {
-    std::unique_ptr<common_installer::AppInstaller> installer =
+    std::unique_ptr<common_installer::AppInstaller> app_installer =
         factory->CreateInstaller(pkgmgr, idx);
-    EXPECT_NE(installer, nullptr);
+    EXPECT_NE(app_installer, nullptr);
   }
 }
 
@@ -236,7 +236,7 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_WrongRecoveryFile) {
                       reinterpret_cast<pkgmgrinfo_pkginfo_h>(handle2)),
                   Return(PMINFO_R_OK)));
 
-  TestPkgmgrInstaller pkgmgr_installer;
+  TestPkgmgrInstaller installer;
   EXPECT_CALL(GetMock<GumMock>(),
       gum_user_get_sync(_, _)).
           WillRepeatedly(Invoke(__gum_user_get_sync_fake));
@@ -244,7 +244,7 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_WrongRecoveryFile) {
   auto pkgmgr = common_installer::PkgMgrInterface::Create(
       argv.size() - 1,
       argv.data(),
-      &pkgmgr_installer,
+      &installer,
       nullptr);
   if (!pkgmgr) {
     ASSERT_TRUE(false);
@@ -256,10 +256,10 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_WrongRecoveryFile) {
       new common_installer::UnifiedInstallerFactory());
 
   for (int idx = 0; idx < 2; idx++) {
-    std::unique_ptr<common_installer::AppInstaller> installer =
+    std::unique_ptr<common_installer::AppInstaller> app_installer =
         factory->CreateInstaller(pkgmgr, idx);
     // TODO(jungh.yeon): Need to add ways about validating instance.
-    EXPECT_EQ(installer, nullptr);
+    EXPECT_EQ(app_installer, nullptr);
   }
 }
 
@@ -273,7 +273,7 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_GetPkgTypeFromPkgFile) {
             reinterpret_cast<const char*>(arg.data())));
   argv.push_back(nullptr);
 
-  TestPkgmgrInstaller pkgmgr_installer;
+  TestPkgmgrInstaller installer;
   EXPECT_CALL(GetMock<GumMock>(),
       gum_user_get_sync(_, _)).
           WillRepeatedly(Invoke(__gum_user_get_sync_fake));
@@ -299,7 +299,7 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_GetPkgTypeFromPkgFile) {
   auto pkgmgr = common_installer::PkgMgrInterface::Create(
       argv.size() - 1,
       argv.data(),
-      &pkgmgr_installer,
+      &installer,
       nullptr);
   if (!pkgmgr) {
     ASSERT_TRUE(false);
@@ -311,10 +311,10 @@ TEST_F(UnifiedInstallerFactoryTest, CreateInstaller_GetPkgTypeFromPkgFile) {
       new common_installer::UnifiedInstallerFactory());
 
   for (int idx = 0; idx < 2; idx++) {
-    std::unique_ptr<common_installer::AppInstaller> installer =
+    std::unique_ptr<common_installer::AppInstaller> app_installer =
         factory->CreateInstaller(pkgmgr, idx);
     // TODO(jungh.yeon): Need to add ways about validating instance.
-    EXPECT_NE(installer, nullptr);
+    EXPECT_NE(app_installer, nullptr);
   }
 }