You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/08/21 13:34:35 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1616: Align the two configure programs (configure.sh and configure.c)

xiaoxiang781216 commented on a change in pull request #1616:
URL: https://github.com/apache/incubator-nuttx/pull/1616#discussion_r474697965



##########
File path: tools/configure.c
##########
@@ -808,12 +851,35 @@ static void check_configured(void)
         }
       else
         {
-          fprintf(stderr, "ERROR: Found %s... Already configured\n",
-                  g_buffer);
-          fprintf(stderr, "       Please 'make distclean' and try again\n");
-          exit(EXIT_FAILURE);
+          snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig",
+                   g_configpath, g_delim);
+          defcfgpath = strdup(g_buffer);
+
+          snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig",
+                   g_topdir, g_delim);
+
+          if (filecmp(g_buffer, defcfgpath))
+            {
+              fprintf(stderr, "No configuration change.\n");
+              free(defcfgpath);
+              exit(EXIT_FAILURE);

Review comment:
       should we exit 0 here like configure.sh?

##########
File path: tools/configure.c
##########
@@ -794,6 +835,8 @@ static void check_configdir(void)
 
 static void check_configured(void)
 {
+  char *defcfgpath = NULL;

Review comment:
       Should we move into else block at line 852 to limit the variable scope?

##########
File path: tools/configure.c
##########
@@ -808,12 +851,35 @@ static void check_configured(void)
         }
       else
         {
-          fprintf(stderr, "ERROR: Found %s... Already configured\n",
-                  g_buffer);
-          fprintf(stderr, "       Please 'make distclean' and try again\n");
-          exit(EXIT_FAILURE);
+          snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig",
+                   g_configpath, g_delim);
+          defcfgpath = strdup(g_buffer);
+
+          snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig",
+                   g_topdir, g_delim);
+
+          if (filecmp(g_buffer, defcfgpath))
+            {
+              fprintf(stderr, "No configuration change.\n");
+              free(defcfgpath);
+              exit(EXIT_FAILURE);
+            }
+
+          if (g_distclean)
+            {
+              run_make("distclean");
+            }
+          else
+            {
+              fprintf(stderr, "Already configured!\n");
+              fprintf(stderr, "Please 'make distclean' and try again.\n");
+              free(defcfgpath);
+              exit(EXIT_FAILURE);
+            }
         }
     }
+
+  free(defcfgpath);

Review comment:
       Move to line 868 and remove line 876?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org