[Bf-blender-cvs] [7c64e33b012] master: makesdna/makesrna: silence output by default

Campbell Barton noreply at git.blender.org
Tue Nov 28 10:22:07 CET 2017


Commit: 7c64e33b012935764ee5358c0e0a5b983d9a78b0
Author: Campbell Barton
Date:   Tue Nov 28 20:27:40 2017 +1100
Branches: master
https://developer.blender.org/rB7c64e33b012935764ee5358c0e0a5b983d9a78b0

makesdna/makesrna: silence output by default

No need to print status for basic & reliable operations,
build systems can output operations they run if needed,
or debug output changed in the source if developers are debugging.

Nice for ninja, so any printed text hints at a problem to fix.

===================================================================

M	source/blender/makesdna/intern/makesdna.c
M	source/blender/makesrna/intern/makesrna.c

===================================================================

diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 2cea8715a65..17e30de4509 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -978,7 +978,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
 	char str[SDNA_MAX_FILENAME_LENGTH], *cp;
 	int firststruct;
 	
-	if (debugSDNA > -1) {
+	if (debugSDNA > 0) {
 		fflush(stdout);
 		printf("Running makesdna at debug level %d\n", debugSDNA);
 	}
@@ -1074,7 +1074,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
 
 	/* file writing */
 
-	if (debugSDNA > -1) printf("Writing file ... ");
+	if (debugSDNA > 0) printf("Writing file ... ");
 		
 	if (nr_names == 0 || nr_structs == 0) {
 		/* pass */
@@ -1184,7 +1184,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
 	MEM_freeN(typelens_64);
 	MEM_freeN(structs);
 
-	if (debugSDNA > -1) printf("done.\n");
+	if (debugSDNA > 0) printf("done.\n");
 	
 	return(0);
 }
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 2c558e56412..ff081a56b61 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -46,6 +46,14 @@
 #  endif
 #endif
 
+/**
+ * Variable to control debug output of makesrna.
+ * debugSRNA:
+ *  - 0 = no output, except errors
+ *  - 1 = detail actions
+ */
+static int debugSRNA = 0;
+
 /* stub for BLI_abort() */
 #ifndef NDEBUG
 void BLI_system_backtrace(FILE *fp)
@@ -62,7 +70,9 @@ void BLI_system_backtrace(FILE *fp)
 static int file_older(const char *file1, const char *file2)
 {
 	struct stat st1, st2;
-	/* printf("compare: %s %s\n", file1, file2); */
+	if (debugSRNA > 0) {
+		printf("compare: %s %s\n", file1, file2);
+	}
 
 	if (stat(file1, &st1)) return 0;
 	if (stat(file2, &st2)) return 0;
@@ -4134,7 +4144,9 @@ int main(int argc, char **argv)
 		return_status = 1;
 	}
 	else {
-		fprintf(stderr, "Running makesrna\n");
+		if (debugSRNA > 0) {
+			fprintf(stderr, "Running makesrna\n");
+		}
 		makesrna_path = argv[0];
 		return_status = rna_preprocess(argv[1]);
 	}



More information about the Bf-blender-cvs mailing list